
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 03/06/2012 08:34:10
-- Generated from EDMX file: C:\svn\Pos\OceansidePos\Kiosk\Database\RemoteDominicaModel.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [Dominica];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ASSN_JOB_CODE_ROLE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ROLES] DROP CONSTRAINT [FK_ASSN_JOB_CODE_ROLE];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_ACCESS_LEVEL_ROLE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ROLES] DROP CONSTRAINT [FK_ASSN_ACCESS_LEVEL_ROLE];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_USER_ROLE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ROLES] DROP CONSTRAINT [FK_ASSN_USER_ROLE];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_MENU_PRODUCT_GROUP_MENU]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_MENU_PRODUCT_GROUP] DROP CONSTRAINT [FK_ASSN_MENU_PRODUCT_GROUP_MENU];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_MENU_PRODUCT_GROUP] DROP CONSTRAINT [FK_ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PAYGRADE_ROLE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ROLES] DROP CONSTRAINT [FK_ASSN_PAYGRADE_ROLE];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_PRODUCT_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP] DROP CONSTRAINT [FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_PRODUCT_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP] DROP CONSTRAINT [FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP] DROP CONSTRAINT [FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRODUCT_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP] DROP CONSTRAINT [FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRODUCT_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_MAP_JOIN_WITH_KIOSK]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS] DROP CONSTRAINT [FK_ASSN_MAP_JOIN_WITH_KIOSK];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS] DROP CONSTRAINT [FK_ASSN_MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_MENU_GROUP_MENU_MENU_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_MENU_GROUP_MENU] DROP CONSTRAINT [FK_ASSN_MENU_GROUP_MENU_MENU_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_MENU_GROUP_MENU_MENU]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_MENU_GROUP_MENU] DROP CONSTRAINT [FK_ASSN_MENU_GROUP_MENU_MENU];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_KIOSK_AUTO_GRATUITY_NODE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_KIOSK_AUTO_GRATUITY] DROP CONSTRAINT [FK_ASSN_KIOSK_AUTO_GRATUITY_NODE];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_KIOSK_AUTO_GRATUITY] DROP CONSTRAINT [FK_ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_NOSALE_ORDER]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[NOSALES] DROP CONSTRAINT [FK_ASSN_NOSALE_ORDER];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_INVOICE_LINE_ITEM_VENDOR_ACCOUNT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[INVOICE_LINE_ITEMS] DROP CONSTRAINT [FK_ASSN_INVOICE_LINE_ITEM_VENDOR_ACCOUNT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_TIMESLIP_SPECIALPAY]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SPECIALPAYS] DROP CONSTRAINT [FK_ASSN_TIMESLIP_SPECIALPAY];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER] DROP CONSTRAINT [FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER] DROP CONSTRAINT [FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER] DROP CONSTRAINT [FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER] DROP CONSTRAINT [FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_PRODUCT] DROP CONSTRAINT [FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_PRODUCT] DROP CONSTRAINT [FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_ORDERPAYMENT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TRANSACTIONS] DROP CONSTRAINT [FK_ASSN_ORDERPAYMENT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_TIMESLIP_SHIFT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TIMESLIPS] DROP CONSTRAINT [FK_ASSN_TIMESLIP_SHIFT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_ORDERSALE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SALES] DROP CONSTRAINT [FK_ASSN_ORDERSALE];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_SHIFT_ORDER]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ORDERS] DROP CONSTRAINT [FK_ASSN_SHIFT_ORDER];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_SHIFT_PAYMENTS]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PAYMENTS] DROP CONSTRAINT [FK_ASSN_SHIFT_PAYMENTS];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_ORDER_GIFT_CARDS_SOLD]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[GIFT_CARDS_SOLDS] DROP CONSTRAINT [FK_ASSN_ORDER_GIFT_CARDS_SOLD];
GO
IF OBJECT_ID(N'[dbo].[FK_SCHEDULE_WORK_CENTER]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SCHEDULES] DROP CONSTRAINT [FK_SCHEDULE_WORK_CENTER];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_PRODUCT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP] DROP CONSTRAINT [FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_PRODUCT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP] DROP CONSTRAINT [FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRINTER_GROUP_PRINTER] DROP CONSTRAINT [FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ASSN_PRINTER_GROUP_PRINTER] DROP CONSTRAINT [FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_RECIPE_PRODUCT_INVENTORY_COUNT_LOG]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[INVENTORY_COUNT_LOGS] DROP CONSTRAINT [FK_ASSN_RECIPE_PRODUCT_INVENTORY_COUNT_LOG];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_RECIPE_INGREDIENT_RECIPE_PRODUCT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[RECIPE_INGREDIENTS] DROP CONSTRAINT [FK_ASSN_RECIPE_INGREDIENT_RECIPE_PRODUCT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_RECIPE_INGREDIENT_RECIPE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[RECIPE_INGREDIENTS] DROP CONSTRAINT [FK_ASSN_RECIPE_INGREDIENT_RECIPE];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_MAP_JOIN_WITH_PRINTER_GROUP]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS] DROP CONSTRAINT [FK_ASSN_MAP_JOIN_WITH_PRINTER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_TIMESLIP_BREAK]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[BREAKS] DROP CONSTRAINT [FK_ASSN_TIMESLIP_BREAK];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_PARENTSALE_WHEN_MODSALE]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SALES] DROP CONSTRAINT [FK_ASSN_PARENTSALE_WHEN_MODSALE];
GO
IF OBJECT_ID(N'[dbo].[FK_BUSINESS_DAYSHIFT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SHIFTS] DROP CONSTRAINT [FK_BUSINESS_DAYSHIFT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_BUSINESS_DAY_DEPOSIT]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[DEPOSITS] DROP CONSTRAINT [FK_ASSN_BUSINESS_DAY_DEPOSIT];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_HOUSE_ACCOUNT_TRANSACTION]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[TRANSACTIONS] DROP CONSTRAINT [FK_ASSN_HOUSE_ACCOUNT_TRANSACTION];
GO
IF OBJECT_ID(N'[dbo].[FK_ASSN_KIOSK_PRODUCT_GROUP_PRINTER_EXCLUSION]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PRODUCT_GROUP_PRINTER_EXCLUSIONS] DROP CONSTRAINT [FK_ASSN_KIOSK_PRODUCT_GROUP_PRINTER_EXCLUSION];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[USERS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[USERS];
GO
IF OBJECT_ID(N'[dbo].[JOB_CODES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[JOB_CODES];
GO
IF OBJECT_ID(N'[dbo].[ACCESS_LEVELS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ACCESS_LEVELS];
GO
IF OBJECT_ID(N'[dbo].[PAYGRADES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PAYGRADES];
GO
IF OBJECT_ID(N'[dbo].[ROLES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ROLES];
GO
IF OBJECT_ID(N'[dbo].[MENUS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[MENUS];
GO
IF OBJECT_ID(N'[dbo].[PRODUCT_GROUPS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PRODUCT_GROUPS];
GO
IF OBJECT_ID(N'[dbo].[FORCED_MODIFIER_GROUPS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[FORCED_MODIFIER_GROUPS];
GO
IF OBJECT_ID(N'[dbo].[ORDERS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ORDERS];
GO
IF OBJECT_ID(N'[dbo].[EXCEPTION_MODIFIER_GROUPS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[EXCEPTION_MODIFIER_GROUPS];
GO
IF OBJECT_ID(N'[dbo].[PRICE_INTERVAL_DISCOUNTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PRICE_INTERVAL_DISCOUNTS];
GO
IF OBJECT_ID(N'[dbo].[TIMESLIPS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TIMESLIPS];
GO
IF OBJECT_ID(N'[dbo].[TRANSACTIONS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TRANSACTIONS];
GO
IF OBJECT_ID(N'[dbo].[SYSCONFIGS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SYSCONFIGS];
GO
IF OBJECT_ID(N'[dbo].[KIOSKS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[KIOSKS];
GO
IF OBJECT_ID(N'[dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS];
GO
IF OBJECT_ID(N'[dbo].[SHIFTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SHIFTS];
GO
IF OBJECT_ID(N'[dbo].[PROCESSORS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PROCESSORS];
GO
IF OBJECT_ID(N'[dbo].[MENU_GROUPS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[MENU_GROUPS];
GO
IF OBJECT_ID(N'[dbo].[PCILOGS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PCILOGS];
GO
IF OBJECT_ID(N'[dbo].[BUSINESS_DAYS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BUSINESS_DAYS];
GO
IF OBJECT_ID(N'[dbo].[PRINTERS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PRINTERS];
GO
IF OBJECT_ID(N'[dbo].[PRINTER_GROUPS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PRINTER_GROUPS];
GO
IF OBJECT_ID(N'[dbo].[SALES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SALES];
GO
IF OBJECT_ID(N'[dbo].[AUTO_GRATUITYS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AUTO_GRATUITYS];
GO
IF OBJECT_ID(N'[dbo].[PAYROLL_RUNS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PAYROLL_RUNS];
GO
IF OBJECT_ID(N'[dbo].[REVENUE_TYPES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[REVENUE_TYPES];
GO
IF OBJECT_ID(N'[dbo].[DAYPARTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[DAYPARTS];
GO
IF OBJECT_ID(N'[dbo].[USER_ACTIONS_LOGS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[USER_ACTIONS_LOGS];
GO
IF OBJECT_ID(N'[dbo].[REVENUE_CENTERS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[REVENUE_CENTERS];
GO
IF OBJECT_ID(N'[dbo].[RECIPE_PRODUCTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[RECIPE_PRODUCTS];
GO
IF OBJECT_ID(N'[dbo].[INVOICE_LINE_ITEMS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[INVOICE_LINE_ITEMS];
GO
IF OBJECT_ID(N'[dbo].[RECIPES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[RECIPES];
GO
IF OBJECT_ID(N'[dbo].[RECIPE_INGREDIENTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[RECIPE_INGREDIENTS];
GO
IF OBJECT_ID(N'[dbo].[INVENTORY_COUNT_LOGS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[INVENTORY_COUNT_LOGS];
GO
IF OBJECT_ID(N'[dbo].[GLCODES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[GLCODES];
GO
IF OBJECT_ID(N'[dbo].[PAYMENTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PAYMENTS];
GO
IF OBJECT_ID(N'[dbo].[DEPOSITS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[DEPOSITS];
GO
IF OBJECT_ID(N'[dbo].[NOSALES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[NOSALES];
GO
IF OBJECT_ID(N'[dbo].[HOUSE_ACCOUNTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[HOUSE_ACCOUNTS];
GO
IF OBJECT_ID(N'[dbo].[VENDOR_ACCOUNTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[VENDOR_ACCOUNTS];
GO
IF OBJECT_ID(N'[dbo].[BREAKS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BREAKS];
GO
IF OBJECT_ID(N'[dbo].[GIFT_CARDS_SOLDS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[GIFT_CARDS_SOLDS];
GO
IF OBJECT_ID(N'[dbo].[SPECIALPAYS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SPECIALPAYS];
GO
IF OBJECT_ID(N'[dbo].[EXCLUSIVE_TAXRATES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[EXCLUSIVE_TAXRATES];
GO
IF OBJECT_ID(N'[dbo].[CASH_TRANSACTIONS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[CASH_TRANSACTIONS];
GO
IF OBJECT_ID(N'[dbo].[COMP_ACCOUNTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[COMP_ACCOUNTS];
GO
IF OBJECT_ID(N'[dbo].[HOUSE_TRANSACTIONS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[HOUSE_TRANSACTIONS];
GO
IF OBJECT_ID(N'[dbo].[SCHEDULES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SCHEDULES];
GO
IF OBJECT_ID(N'[dbo].[FORCED_MODIFIERS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[FORCED_MODIFIERS];
GO
IF OBJECT_ID(N'[dbo].[PRODUCTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PRODUCTS];
GO
IF OBJECT_ID(N'[dbo].[EXCEPTION_MODIFIERS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[EXCEPTION_MODIFIERS];
GO
IF OBJECT_ID(N'[dbo].[FINGERPASSWORDS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[FINGERPASSWORDS];
GO
IF OBJECT_ID(N'[dbo].[WORK_CENTERS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[WORK_CENTERS];
GO
IF OBJECT_ID(N'[dbo].[LOCATION_LAYOUTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LOCATION_LAYOUTS];
GO
IF OBJECT_ID(N'[dbo].[INCLUSIVE_TAXRATES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[INCLUSIVE_TAXRATES];
GO
IF OBJECT_ID(N'[dbo].[INCLUSIVE_TIPRATES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[INCLUSIVE_TIPRATES];
GO
IF OBJECT_ID(N'[dbo].[SURCHARGE_ACCOUNTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SURCHARGE_ACCOUNTS];
GO
IF OBJECT_ID(N'[dbo].[ORDERED_RECIPES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ORDERED_RECIPES];
GO
IF OBJECT_ID(N'[dbo].[TRANSACTION_RESPONSES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[TRANSACTION_RESPONSES];
GO
IF OBJECT_ID(N'[dbo].[CACHES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[CACHES];
GO
IF OBJECT_ID(N'[dbo].[PAYMENT_REASONS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PAYMENT_REASONS];
GO
IF OBJECT_ID(N'[dbo].[BATCH_CLOSE_RESPONSES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BATCH_CLOSE_RESPONSES];
GO
IF OBJECT_ID(N'[dbo].[BATCH_SUMMARY_RESPONSES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BATCH_SUMMARY_RESPONSES];
GO
IF OBJECT_ID(N'[dbo].[PRODUCT_GROUP_PRINTER_EXCLUSIONS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PRODUCT_GROUP_PRINTER_EXCLUSIONS];
GO
IF OBJECT_ID(N'[dbo].[ATTACHED_DEVICES]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ATTACHED_DEVICES];
GO
IF OBJECT_ID(N'[dbo].[CRON_JOBS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[CRON_JOBS];
GO
IF OBJECT_ID(N'[dbo].[PAGELAYOUTS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PAGELAYOUTS];
GO
IF OBJECT_ID(N'[dbo].[LAYOUTOBJS]', 'U') IS NOT NULL
    DROP TABLE [dbo].[LAYOUTOBJS];
GO
IF OBJECT_ID(N'[dbo].[ASSN_MENU_PRODUCT_GROUP]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_MENU_PRODUCT_GROUP];
GO
IF OBJECT_ID(N'[dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP];
GO
IF OBJECT_ID(N'[dbo].[ASSN_MENU_GROUP_MENU]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_MENU_GROUP_MENU];
GO
IF OBJECT_ID(N'[dbo].[ASSN_KIOSK_AUTO_GRATUITY]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_KIOSK_AUTO_GRATUITY];
GO
IF OBJECT_ID(N'[dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER];
GO
IF OBJECT_ID(N'[dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER];
GO
IF OBJECT_ID(N'[dbo].[ASSN_PRODUCT_GROUP_PRODUCT]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_PRODUCT_GROUP_PRODUCT];
GO
IF OBJECT_ID(N'[dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP];
GO
IF OBJECT_ID(N'[dbo].[ASSN_PRINTER_GROUP_PRINTER]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ASSN_PRINTER_GROUP_PRINTER];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'USERS'
CREATE TABLE [dbo].[USERS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [LastName] nvarchar(32)  NOT NULL,
    [FirstName] nvarchar(32)  NOT NULL,
    [UserName] nvarchar(32)  NOT NULL,
    [ScreenName] nvarchar(32)  NOT NULL,
    [Address1] nvarchar(128)  NULL,
    [Address2] nvarchar(128)  NULL,
    [City] nvarchar(64)  NULL,
    [State] nvarchar(32)  NULL,
    [Zipcode] nvarchar(20)  NULL,
    [HomePhone] nvarchar(32)  NULL,
    [SSN] nvarchar(32)  NULL,
    [Birthdate] datetime  NULL,
    [HiredDate] datetime  NOT NULL,
    [Sex] smallint  NULL,
    [LoginBohPassword] varbinary(256)  NULL,
    [LoginKeyPassword] nvarchar(32)  NOT NULL,
    [LoginMagPassword] nvarchar(256)  NULL,
    [IsTerminated] bit  NOT NULL,
    [OldBohPassword1] varbinary(256)  NULL,
    [OldBohPassword2] varbinary(256)  NULL,
    [OldBohPassword3] varbinary(256)  NULL,
    [OldBohPassword4] varbinary(256)  NULL,
    [BohPasswordDate] datetime  NULL,
    [BohPasswordAttempts] int  NOT NULL,
    [BohSecretQuestion] nvarchar(128)  NULL,
    [BohSecretAnswer] nvarchar(64)  NULL,
    [EmailAddress] nvarchar(128)  NULL,
    [BohLockoutDate] datetime  NULL,
    [ExternalPayrollId] bigint  NULL,
    [TerminationDate] datetime  NULL,
    [Country] nvarchar(128)  NOT NULL,
    [MobilePhone] nvarchar(32)  NULL,
    [FingerPasswordId] bigint  NULL,
    [AltPhone] nvarchar(32)  NULL,
    [EmployeeNumber] nvarchar(32)  NULL,
    [RatingNumber] int  NULL,
    [MiddleName] nvarchar(32)  NULL,
    [IsTraining] bit  NULL
);
GO

-- Creating table 'JOB_CODES'
CREATE TABLE [dbo].[JOB_CODES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsBarTender] bit  NOT NULL,
    [IsDeliveryDriver] bit  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [IsCashier] bit  NOT NULL,
    [IsHost] bit  NOT NULL,
    [IsManager] bit  NOT NULL,
    [IsCook] bit  NOT NULL,
    [IsRetail] bit  NOT NULL,
    [IsWaiter] bit  NOT NULL,
    [IsValet] bit  NOT NULL,
    [GrowthBool_1] bit  NOT NULL,
    [GrowthBool_2] bit  NOT NULL,
    [GrowthBool_3] bit  NOT NULL,
    [GrowthBool_4] bit  NOT NULL,
    [GrowthBool_5] bit  NOT NULL,
    [GrowthBool_6] bit  NOT NULL,
    [GrowthBool_7] bit  NOT NULL,
    [GrowthBool_8] bit  NOT NULL,
    [GrowthBool_10] bit  NOT NULL,
    [GrowthBool_9] bit  NOT NULL,
    [GrowthBool_11] bit  NOT NULL,
    [GrowthBool_12] bit  NOT NULL,
    [GrowthBool_13] bit  NOT NULL,
    [GrowthBool_14] bit  NOT NULL,
    [GrowthBool_15] bit  NOT NULL,
    [IsSalaried] bit  NOT NULL
);
GO

-- Creating table 'ACCESS_LEVELS'
CREATE TABLE [dbo].[ACCESS_LEVELS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [CanViewReports] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [CanApplyCompToItem] bit  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [CanOrder] bit  NOT NULL,
    [CanAccessSystemConfig] bit  NOT NULL,
    [CanSetMagStripe] bit  NOT NULL,
    [RequireMagcardLogin] bit  NOT NULL,
    [CanCaptureElectronicPayments] bit  NOT NULL,
    [CanSearchAllPayments] bit  NOT NULL,
    [CanTransferOrder] bit  NOT NULL,
    [GrowthBool_1] bit  NOT NULL,
    [GrowthBool_2] bit  NOT NULL,
    [GrowthBool_3] bit  NOT NULL,
    [CanApplyAdditionalSurcharge] bit  NOT NULL,
    [CanNoSale] bit  NOT NULL,
    [GrowthBool_4] bit  NOT NULL,
    [GrowthBool_5] bit  NOT NULL,
    [GrowthBool_6] bit  NOT NULL,
    [GrowthBool_7] bit  NOT NULL,
    [GrowthBool_8] bit  NOT NULL,
    [GrowthBool_9] bit  NOT NULL,
    [GrowthBool_10] bit  NOT NULL,
    [GrowthBool_11] bit  NOT NULL,
    [GrowthBool_12] bit  NOT NULL,
    [GrowthBool_13] bit  NOT NULL,
    [GrowthBool_14] bit  NOT NULL,
    [GrowthBool_15] bit  NOT NULL,
    [CanReopenOrder] bit  NOT NULL,
    [CanSeeOtherUsersOrders] bit  NOT NULL,
    [CanCloseHouse] bit  NOT NULL,
    [CanBatchPayments] bit  NOT NULL,
    [CanPromoCheck] bit  NOT NULL,
    [CanApplyVoidToItem] bit  NOT NULL,
    [CanVoidPayment] bit  NOT NULL,
    [CanApplyHousePayment] bit  NOT NULL,
    [CanPayIn] bit  NOT NULL,
    [CanPayOut] bit  NOT NULL
);
GO

-- Creating table 'PAYGRADES'
CREATE TABLE [dbo].[PAYGRADES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [WageRate] decimal(18,2)  NOT NULL,
    [TipTaxRate] decimal(18,2)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [IsSalaried] bit  NOT NULL,
    [OTAppliedByDayHours] bit  NOT NULL,
    [WageRateOnOverTime] decimal(18,2)  NOT NULL,
    [BreaksArePaid] bit  NOT NULL,
    [OTHoursThreshold] decimal(18,2)  NOT NULL,
    [IsEligibleForOvertimePay] bit  NOT NULL,
    [Name] nvarchar(64)  NOT NULL
);
GO

-- Creating table 'ROLES'
CREATE TABLE [dbo].[ROLES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [NavJobCodeId] bigint  NOT NULL,
    [NavAccessLevelId] bigint  NOT NULL,
    [UserId] bigint  NOT NULL,
    [NavPaygradeId] bigint  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [IsPrimary] bit  NOT NULL
);
GO

-- Creating table 'MENUS'
CREATE TABLE [dbo].[MENUS] (
    [Name] nvarchar(max)  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [StartTime] datetime  NOT NULL,
    [EndTime] datetime  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [OrderMenuItemsByWeight] bit  NOT NULL,
    [DefaultSelectedProductGroupId] bigint  NULL,
    [DaysToRunFlags] smallint  NULL
);
GO

-- Creating table 'PRODUCT_GROUPS'
CREATE TABLE [dbo].[PRODUCT_GROUPS] (
    [Name] nvarchar(max)  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [MenuPosition] int  NOT NULL,
    [CanDiscountGroup] bit  NOT NULL,
    [UseDriversAgeVerification] bit  NOT NULL,
    [ApplyGroupPrice] bit  NOT NULL,
    [GroupPrice] decimal(18,2)  NOT NULL,
    [OrderMenuItemsByWeight] bit  NOT NULL
);
GO

-- Creating table 'FORCED_MODIFIER_GROUPS'
CREATE TABLE [dbo].[FORCED_MODIFIER_GROUPS] (
    [Name] nvarchar(max)  NOT NULL,
    [MaximumChoice] tinyint  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [ApplyGroupPrice] bit  NOT NULL,
    [GroupPrice] decimal(18,2)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [MenuPosition] int  NOT NULL,
    [MinimumChoice] tinyint  NOT NULL,
    [ExceptionModOnForcedModGroupId] bigint  NULL,
    [OrderMenuItemsByWeight] bit  NOT NULL
);
GO

-- Creating table 'ORDERS'
CREATE TABLE [dbo].[ORDERS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [OpenDateStamp] datetime  NOT NULL,
    [CreatorId] bigint  NOT NULL,
    [CloserId] bigint  NULL,
    [TableName] nvarchar(max)  NOT NULL,
    [GuestCount] int  NOT NULL,
    [ClosedDateStamp] datetime  NULL,
    [ReservationTime] datetime  NULL,
    [SitDownTime] datetime  NULL,
    [FirstOrderTime] datetime  NULL,
    [LastOrderTime] datetime  NULL,
    [FirstPrintTime] datetime  NULL,
    [FirstPayTime] datetime  NULL,
    [LastPayTime] datetime  NULL,
    [UserId] bigint  NOT NULL,
    [PrintCount] bigint  NOT NULL,
    [ReopenTime] datetime  NULL,
    [ReopenByUserId] bigint  NULL,
    [IsBarSeat] bit  NOT NULL,
    [CustomerName] nvarchar(max)  NULL,
    [HasHeadOfTable] bit  NOT NULL,
    [TableInt] int  NOT NULL,
    [CustomerId] bigint  NULL,
    [KioskWhereCreatedId] bigint  NULL,
    [NavEmployeeShiftId] bigint  NULL,
    [HasProductsOnHold] bit  NOT NULL,
    [CheckCount] int  NOT NULL,
    [IsClosed] bit  NOT NULL,
    [BusinessDayId] bigint  NOT NULL,
    [CardOnFileExtId] bigint  NULL,
    [HasCardOnFile] bit  NOT NULL,
    [RevenueCenterId] bigint  NOT NULL,
    [HasTimedOut] bit  NOT NULL,
    [LastAttentedToDateStamp] datetime  NOT NULL,
    [LastModifiedDateStamp] datetime  NOT NULL,
    [SplitBySeatHasBeenApplied] bit  NULL,
    [UserChangedCheckSinceSplitBySeat] bit  NULL,
    [EqualPayIsActive] bit  NULL,
    [EqualPayCount] int  NULL
);
GO

-- Creating table 'EXCEPTION_MODIFIER_GROUPS'
CREATE TABLE [dbo].[EXCEPTION_MODIFIER_GROUPS] (
    [Name] nvarchar(max)  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [ApplyGroupPrice] bit  NOT NULL,
    [GroupPrice] decimal(18,2)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [MenuPosition] int  NOT NULL,
    [ExceptionModOnExceptionModGroupId] bigint  NULL,
    [OrderMenuItemsByWeight] bit  NOT NULL
);
GO

-- Creating table 'PRICE_INTERVAL_DISCOUNTS'
CREATE TABLE [dbo].[PRICE_INTERVAL_DISCOUNTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [AmountOrPercent] decimal(18,2)  NOT NULL,
    [StartTime] datetime  NOT NULL,
    [EndTime] datetime  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [IsPercentOff] bit  NOT NULL,
    [IsDollarsOff] bit  NOT NULL,
    [IsSpecifiedPrice] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'TIMESLIPS'
CREATE TABLE [dbo].[TIMESLIPS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [ClockedIn] datetime  NOT NULL,
    [ClockedOut] datetime  NULL,
    [IsDeleted] bit  NOT NULL,
    [EditedByUserId] bigint  NULL,
    [WasEdited] bit  NOT NULL,
    [ClockedInDaypartId] bigint  NOT NULL,
    [ClockedOutDaypartId] bigint  NULL,
    [RoleId] bigint  NOT NULL,
    [ClockedInKioskId] bigint  NOT NULL,
    [ClockedOutKioskId] bigint  NULL,
    [UserId] bigint  NOT NULL,
    [RevenueCenterId] bigint  NOT NULL,
    [CashTipsClaimed] decimal(18,2)  NOT NULL,
    [WasAutoClockedOut] bit  NOT NULL,
    [SHIFT_Id] bigint  NOT NULL
);
GO

-- Creating table 'TRANSACTIONS'
CREATE TABLE [dbo].[TRANSACTIONS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Base] decimal(18,2)  NOT NULL,
    [CustomerName] nvarchar(max)  NULL,
    [TransactionType] int  NOT NULL,
    [OpenDateStamp] datetime  NOT NULL,
    [WasAutoTipped] bit  NOT NULL,
    [TenderMemo] nvarchar(max)  NULL,
    [TransactionTypeId] bigint  NOT NULL,
    [NavOrderId] bigint  NOT NULL,
    [PaidAtRevenueCenterId] bigint  NOT NULL,
    [CustomerId] bigint  NULL,
    [OwningCheckNumber] int  NOT NULL,
    [LastModifiedDateStamp] datetime  NOT NULL,
    [UserId] bigint  NOT NULL,
    [Gratuity] decimal(18,2)  NOT NULL,
    [Change] decimal(18,2)  NOT NULL,
    [ExtId] bigint  NULL,
    [LastModifiedUserId] bigint  NOT NULL,
    [IsBatched] bit  NOT NULL,
    [BusinessDayId] bigint  NOT NULL,
    [NavHouseAccountId] bigint  NULL,
    [WasVoided] bit  NOT NULL,
    [TenderType] int  NOT NULL,
    [CreditCardTipFee] decimal(18,2)  NOT NULL,
    [TerminalId] bigint  NULL
);
GO

-- Creating table 'SYSCONFIGS'
CREATE TABLE [dbo].[SYSCONFIGS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [UserMagSwipeToken] nvarchar(max)  NOT NULL,
    [CanAcceptTips] bit  NOT NULL,
    [DbVersion] int  NOT NULL,
    [ReceiptLine1] nvarchar(max)  NULL,
    [ReceiptLine2] nvarchar(max)  NULL,
    [ReceiptLine3] nvarchar(max)  NULL,
    [ReceiptLine4] nvarchar(max)  NULL,
    [ForceOrderOnScreenTimeout] bit  NOT NULL,
    [ScreenLockTimeout] int  NOT NULL,
    [PrintQueueTimeout] int  NOT NULL,
    [StoreId] uniqueidentifier  NOT NULL,
    [HouseHasCashier] bit  NOT NULL,
    [CreditCardTipFeeAsRate] decimal(18,2)  NOT NULL,
    [CreditCardTipFeeAsTransaction] decimal(18,2)  NOT NULL,
    [TopReceiptMessage] nvarchar(max)  NULL,
    [BottomReceiptMessage] nvarchar(max)  NULL,
    [BusinessDayOfWeekStartDay] nvarchar(max)  NOT NULL,
    [BusinessDayStartTime] datetime  NOT NULL,
    [IncludeDiscountsInNetSales] bit  NOT NULL,
    [CurrentBusinessDayId] bigint  NULL,
    [IsBeingEdited] bit  NOT NULL,
    [EditedByUserId] bigint  NULL,
    [EditedOnKioskId] bigint  NULL,
    [TableRecheckMinutes] int  NOT NULL,
    [AllowCardOnFile] bit  NOT NULL,
    [OrderTimeoutInMinutes] int  NOT NULL,
    [AllowDuplicateTables] bit  NOT NULL,
    [DailyHighWaterMark] decimal(18,2)  NOT NULL,
    [EmailManagersAtHighWater] bit  NOT NULL,
    [UseRealTimeReportSync] bit  NOT NULL,
    [TrainingDbConnection] nvarchar(max)  NULL
);
GO

-- Creating table 'KIOSKS'
CREATE TABLE [dbo].[KIOSKS] (
    [Name] nvarchar(max)  NOT NULL,
    [NumberOfCashDrawers] tinyint  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [FirstCashDrawerNumber] int  NOT NULL,
    [OpenDrawerOnPay] bit  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [SystemComFlags] bigint  NOT NULL,
    [MagStripeDelay] int  NOT NULL,
    [CreateAutoSeats] bit  NOT NULL,
    [RevenueCenterId] bigint  NOT NULL,
    [ForceOrderProdId] bigint  NULL,
    [MenuGroupId] bigint  NULL,
    [ForceOrderProdGroupId] bigint  NULL,
    [LocalPrinterId] bigint  NULL,
    [PrintItemizedReceiptOnPay] bit  NOT NULL,
    [PrintCashReceiptOnPay] bit  NOT NULL,
    [SwRevision] nvarchar(max)  NULL,
    [UseProductGroupPrinterMapping] bit  NOT NULL,
    [Notes] nvarchar(max)  NULL,
    [Spare64] bigint  NULL,
    [ForceCashDrop] bit  NULL,
    [ForceCashDropAmount] decimal(18,2)  NULL,
    [PrintCreditReceiptOnPay] bit  NOT NULL,
    [PrintGiftReceiptOnPay] bit  NOT NULL,
    [NumberCashReceipts] tinyint  NOT NULL,
    [NumberCreditReceipts] tinyint  NOT NULL,
    [NumberGiftReceipts] tinyint  NOT NULL
);
GO

-- Creating table 'MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS'
CREATE TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [NavKioskId] bigint  NOT NULL,
    [NavProductGroupId] bigint  NOT NULL,
    [NavPrinterGroupId] bigint  NOT NULL
);
GO

-- Creating table 'SHIFTS'
CREATE TABLE [dbo].[SHIFTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [DrawerStart] decimal(18,2)  NOT NULL,
    [IsComplete] bit  NOT NULL,
    [DateStamp] datetime  NOT NULL,
    [UserId] bigint  NOT NULL,
    [OpenDrawerCount] int  NOT NULL,
    [IsLocked] bit  NOT NULL,
    [LastKioskId] bigint  NOT NULL,
    [MyDrawerOwnershipStatus] int  NOT NULL,
    [MyDrawerOwnerTermId] bigint  NULL,
    [IsClockedIn] bit  NOT NULL,
    [IsOnBreak] bit  NOT NULL,
    [NavBusinessDayId] bigint  NOT NULL,
    [WorkCenterId] bigint  NULL,
    [Notes] nvarchar(max)  NULL
);
GO

-- Creating table 'PROCESSORS'
CREATE TABLE [dbo].[PROCESSORS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [MerchantId] nvarchar(max)  NOT NULL,
    [ProcessorType] nvarchar(max)  NOT NULL,
    [Password] nvarchar(max)  NULL,
    [CardType] nvarchar(max)  NOT NULL,
    [IsSelected] bit  NOT NULL,
    [CfgFile] nvarchar(max)  NULL,
    [EP1] nvarchar(max)  NULL,
    [EP2] nvarchar(max)  NULL,
    [AllowPartial] bit  NOT NULL,
    [PinDebitCom] nvarchar(max)  NULL,
    [ExtDevicePrompt] nvarchar(max)  NULL,
    [IsRetail] bit  NOT NULL,
    [AutoTipGiftTransactions] bit  NOT NULL,
    [AutoTipRate] decimal(18,4)  NOT NULL,
    [QuickServiceHighTicket] decimal(18,4)  NULL
);
GO

-- Creating table 'MENU_GROUPS'
CREATE TABLE [dbo].[MENU_GROUPS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'PCILOGS'
CREATE TABLE [dbo].[PCILOGS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [DateStamp] datetime  NOT NULL,
    [Action] nvarchar(max)  NOT NULL,
    [UserId] bigint  NOT NULL
);
GO

-- Creating table 'BUSINESS_DAYS'
CREATE TABLE [dbo].[BUSINESS_DAYS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsComplete] bit  NOT NULL,
    [CheckoutDateStamp] datetime  NULL,
    [BusinessDayDateStamp] datetime  NOT NULL,
    [CloseoutKioskId] bigint  NOT NULL,
    [BatchSummaryId] bigint  NULL,
    [BatchCloseId] bigint  NULL,
    [AMNotes] nvarchar(max)  NULL,
    [WeatherSummary] nvarchar(max)  NULL,
    [LunchNotes] nvarchar(max)  NULL,
    [PMNotes] nvarchar(max)  NULL
);
GO

-- Creating table 'PRINTERS'
CREATE TABLE [dbo].[PRINTERS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Path] nvarchar(max)  NOT NULL,
    [Manufacturer] nvarchar(max)  NOT NULL,
    [Model] nvarchar(max)  NOT NULL,
    [IpAddress] nvarchar(max)  NULL,
    [IsProductGroupPrinter] bit  NOT NULL,
    [PathToDevInfoFile] nvarchar(max)  NULL,
    [IsPCPrinter] bit  NOT NULL
);
GO

-- Creating table 'PRINTER_GROUPS'
CREATE TABLE [dbo].[PRINTER_GROUPS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'SALES'
CREATE TABLE [dbo].[SALES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [ProductId] bigint  NOT NULL,
    [ProductsMainCatId] bigint  NOT NULL,
    [CountsAsSalesRevenue] bit  NOT NULL,
    [MenuPrice] decimal(18,2)  NOT NULL,
    [IsForcedModifier] bit  NOT NULL,
    [ProductName] nvarchar(max)  NOT NULL,
    [NoteForPrint] nvarchar(max)  NOT NULL,
    [PrinterGroupingId] bigint  NULL,
    [OnHold] bit  NOT NULL,
    [IsForcedProduct] bit  NOT NULL,
    [PrintJobId] uniqueidentifier  NULL,
    [OwningSeatNumber] int  NOT NULL,
    [OwningCheckNumber] int  NOT NULL,
    [IsExceptionModifier] bit  NOT NULL,
    [NavOrderId] bigint  NOT NULL,
    [ProductIsDiscountable] bit  NOT NULL,
    [Sku] nvarchar(max)  NULL,
    [UserId] bigint  NOT NULL,
    [Ordermode] nvarchar(max)  NOT NULL,
    [CountOrdered] int  NOT NULL,
    [BumpbarPreparedTimed] datetime  NULL,
    [RevenueCenterId] bigint  NOT NULL,
    [DaypartId] bigint  NOT NULL,
    [IsWithout] bit  NOT NULL,
    [NoteForPrintBeforeHold] nvarchar(max)  NOT NULL,
    [HoldMinutes] int  NOT NULL,
    [FirstOrderedDateTime] datetime  NOT NULL,
    [LastOrderedDateTime] datetime  NOT NULL,
    [CountPendingKitchenSend] int  NOT NULL,
    [CheckSequenceNumber] int  NOT NULL,
    [NavParentSaleWhenModSaleId] bigint  NULL,
    [ActualPrice] decimal(18,2)  NOT NULL,
    [ExclusiveTaxRate] decimal(18,8)  NOT NULL,
    [WasVoided] bit  NOT NULL,
    [DiscountId] bigint  NULL,
    [DiscountManagerId] bigint  NULL,
    [SurchargeManagerId] bigint  NULL,
    [DiscountRate] decimal(18,6)  NOT NULL,
    [SurchargeRate] decimal(18,6)  NOT NULL,
    [AutoGratuityRate] decimal(18,6)  NOT NULL,
    [AutoGratuityId] bigint  NULL,
    [ExclusiveTaxRateId] bigint  NULL,
    [InclusiveTaxRateId] bigint  NULL,
    [SurchargeId] bigint  NULL,
    [SeatSequenceNumber] int  NOT NULL,
    [Notes] nvarchar(max)  NULL,
    [WasCompedInEntire] bit  NOT NULL,
    [InclusiveTaxRate] decimal(18,8)  NOT NULL,
    [SurchargeAmountFlatFee] decimal(18,2)  NOT NULL,
    [IsSeeServer] bit  NOT NULL,
    [ApplyAutoGratToMenuPrice] bit  NOT NULL,
    [DiscountAppliedAtCheckLevel] bit  NOT NULL,
    [RevenueTypeId] bigint  NOT NULL,
    [IsGiftCardSale] bit  NOT NULL
);
GO

-- Creating table 'AUTO_GRATUITYS'
CREATE TABLE [dbo].[AUTO_GRATUITYS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [AutoGratuityRate] decimal(18,2)  NOT NULL,
    [AutoGratuitySeatStartCount] int  NOT NULL,
    [RunMonday] bit  NOT NULL,
    [RunTuesday] bit  NOT NULL,
    [RunWednesday] bit  NOT NULL,
    [RunThursday] bit  NOT NULL,
    [RunFriday] bit  NOT NULL,
    [RunSaturday] bit  NOT NULL,
    [RunSunday] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [EnableAboveTicketAmount] bit  NOT NULL,
    [AboveTicketAmount] decimal(18,2)  NOT NULL,
    [MondayStartTime] datetime  NOT NULL,
    [MondayEndTime] datetime  NOT NULL,
    [TuesdayStartTime] datetime  NOT NULL,
    [TuesdayEndTime] datetime  NOT NULL,
    [WednesdayStartTime] datetime  NOT NULL,
    [WednesdayEndTime] datetime  NOT NULL,
    [ThursdayStartTime] datetime  NOT NULL,
    [ThursdayEndTime] datetime  NOT NULL,
    [FridayStartTime] datetime  NOT NULL,
    [FridayEndTime] datetime  NOT NULL,
    [SaturdayStartTime] datetime  NOT NULL,
    [SaturdayEndTime] datetime  NOT NULL,
    [SundayStartTime] datetime  NOT NULL,
    [SundayEndTime] datetime  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [ApplyOnMenuPrice] bit  NOT NULL
);
GO

-- Creating table 'PAYROLL_RUNS'
CREATE TABLE [dbo].[PAYROLL_RUNS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [StartDate] datetime  NOT NULL,
    [EndDate] datetime  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'REVENUE_TYPES'
CREATE TABLE [dbo].[REVENUE_TYPES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [IncludedInNetSales] bit  NOT NULL
);
GO

-- Creating table 'DAYPARTS'
CREATE TABLE [dbo].[DAYPARTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [StartTime] datetime  NOT NULL,
    [EndTime] datetime  NOT NULL,
    [IsDefault] bit  NOT NULL,
    [DaypartOrdinal] int  NOT NULL
);
GO

-- Creating table 'USER_ACTIONS_LOGS'
CREATE TABLE [dbo].[USER_ACTIONS_LOGS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [DateStamp] datetime  NOT NULL,
    [Action] nvarchar(max)  NOT NULL,
    [UserId] bigint  NOT NULL,
    [AssociatedId] bigint  NOT NULL
);
GO

-- Creating table 'REVENUE_CENTERS'
CREATE TABLE [dbo].[REVENUE_CENTERS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'RECIPE_PRODUCTS'
CREATE TABLE [dbo].[RECIPE_PRODUCTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Count] int  NOT NULL,
    [ConversionUnit] nvarchar(max)  NOT NULL,
    [ContainerSize] decimal(18,2)  NOT NULL,
    [InventoryTakingUnit] nvarchar(max)  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [GLCodeId] bigint  NOT NULL,
    [SKU] nvarchar(max)  NULL,
    [PLU] nvarchar(max)  NULL,
    [UPC] nvarchar(max)  NULL
);
GO

-- Creating table 'INVOICE_LINE_ITEMS'
CREATE TABLE [dbo].[INVOICE_LINE_ITEMS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [InvoiceDate] datetime  NOT NULL,
    [InvoiceTotal] decimal(18,2)  NOT NULL,
    [PurchaseQuantity] int  NOT NULL,
    [VendorItemCode] nvarchar(max)  NULL,
    [VendorItemName] nvarchar(max)  NOT NULL,
    [PurchaseUnitName] nvarchar(max)  NOT NULL,
    [ContainerSize] decimal(18,2)  NOT NULL,
    [UnitCost] decimal(18,2)  NOT NULL,
    [ExtendedCost] decimal(18,2)  NOT NULL,
    [InvoiceNumber] nvarchar(max)  NOT NULL,
    [ConversionUnit] nvarchar(max)  NOT NULL,
    [NavVendorAccountId] bigint  NOT NULL,
    [GLCodeId] bigint  NOT NULL
);
GO

-- Creating table 'RECIPES'
CREATE TABLE [dbo].[RECIPES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'RECIPE_INGREDIENTS'
CREATE TABLE [dbo].[RECIPE_INGREDIENTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Amount] decimal(18,2)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [Count] int  NOT NULL,
    [NavRecipeProductId] bigint  NOT NULL,
    [NavRecipeId] bigint  NOT NULL
);
GO

-- Creating table 'INVENTORY_COUNT_LOGS'
CREATE TABLE [dbo].[INVENTORY_COUNT_LOGS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [OriginalCount] bigint  NOT NULL,
    [NewCount] bigint  NOT NULL,
    [PricePerUnit] decimal(18,2)  NOT NULL,
    [InventoryDate] datetime  NOT NULL,
    [UserId] bigint  NOT NULL,
    [StorageLocation] nvarchar(max)  NULL,
    [Notes] nvarchar(max)  NOT NULL,
    [NavRecipeProductId] bigint  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'GLCODES'
CREATE TABLE [dbo].[GLCODES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'PAYMENTS'
CREATE TABLE [dbo].[PAYMENTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [EmployeeId] bigint  NOT NULL,
    [TransactionDate] datetime  NOT NULL,
    [Details] nvarchar(64)  NULL,
    [AffectsCash] bit  NOT NULL,
    [Amount] decimal(18,2)  NOT NULL,
    [WasChangeFromVoucher] bit  NOT NULL,
    [WasChangeFromGiftCard] bit  NOT NULL,
    [WasCreditCardAdvance] bit  NOT NULL,
    [NavEmployeeShiftId] bigint  NOT NULL,
    [TransactionType] int  NOT NULL,
    [WasDrawerStart] bit  NOT NULL,
    [WasDrawerEnd] bit  NOT NULL,
    [WasPaidIn] bit  NOT NULL,
    [DaypartId] bigint  NOT NULL,
    [RevenueCenterId] bigint  NOT NULL,
    [UserId] bigint  NOT NULL,
    [TransactionTypeId] bigint  NULL,
    [ReasonId] bigint  NOT NULL,
    [TerminalId] bigint  NULL
);
GO

-- Creating table 'DEPOSITS'
CREATE TABLE [dbo].[DEPOSITS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [BusinessDate] datetime  NOT NULL,
    [TransactionDate] datetime  NOT NULL,
    [EmployeeId] bigint  NOT NULL,
    [Amount] decimal(18,2)  NOT NULL,
    [TerminalId] bigint  NULL,
    [Notes] nvarchar(max)  NULL,
    [Type] int  NULL,
    [BUSINESS_DAY_Id] bigint  NOT NULL
);
GO

-- Creating table 'NOSALES'
CREATE TABLE [dbo].[NOSALES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [DateTime] datetime  NOT NULL,
    [UserId] bigint  NOT NULL,
    [NavOrderId] bigint  NULL
);
GO

-- Creating table 'HOUSE_ACCOUNTS'
CREATE TABLE [dbo].[HOUSE_ACCOUNTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [LastName] nvarchar(max)  NULL,
    [FirstName] nvarchar(max)  NULL,
    [Address1] nvarchar(max)  NULL,
    [Address2] nvarchar(max)  NULL,
    [City] nvarchar(max)  NULL,
    [State] nvarchar(max)  NULL,
    [Zipcode] nvarchar(max)  NULL,
    [Telephone] nvarchar(max)  NULL,
    [TaxId] nvarchar(max)  NULL,
    [CreateDate] datetime  NOT NULL,
    [Active] bit  NOT NULL,
    [EmailAddress] nvarchar(max)  NULL,
    [Name] nvarchar(max)  NOT NULL,
    [AccountLimit] decimal(18,2)  NOT NULL,
    [AccountTerms] nvarchar(max)  NULL,
    [HasNoHighLimit] bit  NOT NULL,
    [Fax] nvarchar(max)  NULL,
    [IsDeleted] bit  NOT NULL,
    [CellPhone] nvarchar(max)  NULL,
    [IsVoucher] bit  NOT NULL,
    [IsCoupon] bit  NOT NULL
);
GO

-- Creating table 'VENDOR_ACCOUNTS'
CREATE TABLE [dbo].[VENDOR_ACCOUNTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [LastName] nvarchar(max)  NULL,
    [FirstName] nvarchar(max)  NULL,
    [Address1] nvarchar(max)  NOT NULL,
    [Address2] nvarchar(max)  NULL,
    [City] nvarchar(max)  NOT NULL,
    [State] nvarchar(max)  NOT NULL,
    [Zipcode] nvarchar(max)  NOT NULL,
    [Telephone] nvarchar(max)  NOT NULL,
    [AccountNumber] nvarchar(max)  NULL,
    [CreateDate] datetime  NOT NULL,
    [Active] bit  NOT NULL,
    [EmailAddress] nvarchar(max)  NULL,
    [CompanyName] nvarchar(max)  NOT NULL,
    [AccountLimit] decimal(18,2)  NOT NULL,
    [AccountTerms] nvarchar(max)  NULL,
    [HasNoHighLimit] bit  NOT NULL,
    [Fax] nvarchar(max)  NULL,
    [IsDeleted] bit  NOT NULL,
    [Country] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'BREAKS'
CREATE TABLE [dbo].[BREAKS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [BreakStart] datetime  NOT NULL,
    [BreakStop] datetime  NULL,
    [NavTimePunchId] bigint  NOT NULL
);
GO

-- Creating table 'GIFT_CARDS_SOLDS'
CREATE TABLE [dbo].[GIFT_CARDS_SOLDS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [DateStamp] datetime  NOT NULL,
    [CustomerId] bigint  NULL,
    [Amount] decimal(18,2)  NOT NULL,
    [NavOrderId] bigint  NOT NULL,
    [DaypartId] bigint  NOT NULL,
    [RevenueCenterId] bigint  NOT NULL,
    [GiftCardNumber] nvarchar(max)  NULL,
    [SaleId] bigint  NOT NULL
);
GO

-- Creating table 'SPECIALPAYS'
CREATE TABLE [dbo].[SPECIALPAYS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [SpecialPay] decimal(18,2)  NOT NULL,
    [SpecialPayname] nvarchar(max)  NOT NULL,
    [TIMESLIP_Id] bigint  NOT NULL
);
GO

-- Creating table 'EXCLUSIVE_TAXRATES'
CREATE TABLE [dbo].[EXCLUSIVE_TAXRATES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Rate] decimal(18,6)  NOT NULL
);
GO

-- Creating table 'CASH_TRANSACTIONS'
CREATE TABLE [dbo].[CASH_TRANSACTIONS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [TransactionId] bigint  NULL
);
GO

-- Creating table 'COMP_ACCOUNTS'
CREATE TABLE [dbo].[COMP_ACCOUNTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [IsPromo] bit  NOT NULL,
    [IsVariableAmount] bit  NOT NULL,
    [RateAsDollarOrPercent] decimal(18,2)  NOT NULL,
    [IsVoid] bit  NOT NULL,
    [IsComp] bit  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [PromptUserToEnterNotes] bit  NOT NULL
);
GO

-- Creating table 'HOUSE_TRANSACTIONS'
CREATE TABLE [dbo].[HOUSE_TRANSACTIONS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [HouseAccountId] bigint  NOT NULL,
    [OrderId] bigint  NOT NULL,
    [TransactionId] bigint  NOT NULL
);
GO

-- Creating table 'SCHEDULES'
CREATE TABLE [dbo].[SCHEDULES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [StartTime] datetime  NOT NULL,
    [EndTime] datetime  NOT NULL,
    [EmployeeId] bigint  NOT NULL,
    [JobcodeId] bigint  NOT NULL,
    [BusinessDate] datetime  NOT NULL,
    [Notes] nvarchar(256)  NULL,
    [NavWorkCenterId] bigint  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'FORCED_MODIFIERS'
CREATE TABLE [dbo].[FORCED_MODIFIERS] (
    [Name] nvarchar(max)  NOT NULL,
    [Price] decimal(18,2)  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [RemoveAtZeroCount] bit  NOT NULL,
    [Downtick] bigint  NOT NULL,
    [SurchargeId] bigint  NULL,
    [MenuPosition] int  NOT NULL,
    [PLU] nvarchar(max)  NULL,
    [SKU] nvarchar(max)  NULL,
    [DownTickSemaphoreIsLocked] bit  NOT NULL,
    [RevenueTypeId] bigint  NOT NULL,
    [OrderedRecipeId] bigint  NULL,
    [ExclusiveTaxRateId] bigint  NOT NULL,
    [ProductGroupPrinterId] bigint  NOT NULL,
    [UPC] nvarchar(max)  NULL,
    [LongName] nvarchar(max)  NULL,
    [InclusiveTaxRateId] bigint  NULL,
    [InclusiveTipRateId] bigint  NULL,
    [CalorieCount] int  NOT NULL,
    [ForcedModGroupOnForcedModId] bigint  NULL
);
GO

-- Creating table 'PRODUCTS'
CREATE TABLE [dbo].[PRODUCTS] (
    [RevenueTypeId] bigint  NOT NULL,
    [OrderedRecipeId] bigint  NULL,
    [Name] nvarchar(max)  NOT NULL,
    [Price] decimal(18,2)  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [RemoveAtZeroCount] bit  NOT NULL,
    [Downtick] bigint  NOT NULL,
    [SurchargeId] bigint  NULL,
    [MenuPosition] int  NOT NULL,
    [SKU] nvarchar(max)  NULL,
    [PLU] nvarchar(max)  NULL,
    [DownTickSemaphoreIsLocked] bit  NOT NULL,
    [ExclusiveTaxRateId] bigint  NOT NULL,
    [ProductGroupPrinterId] bigint  NULL,
    [UPC] nvarchar(max)  NULL,
    [LongName] nvarchar(max)  NULL,
    [InclusiveTaxRateId] bigint  NULL,
    [InclusiveTipRateId] bigint  NULL,
    [CalorieCount] int  NOT NULL,
    [PromptForPrice] bit  NOT NULL,
    [IsGiftCard] bit  NOT NULL,
    [PricePerUnitOfWeight] decimal(18,4)  NOT NULL,
    [UseWeightPricing] bit  NOT NULL,
    [UnitOfWeightSize] decimal(18,10)  NOT NULL
);
GO

-- Creating table 'EXCEPTION_MODIFIERS'
CREATE TABLE [dbo].[EXCEPTION_MODIFIERS] (
    [Name] nvarchar(max)  NOT NULL,
    [Price] decimal(18,2)  NOT NULL,
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [RemoveAtZeroCount] bit  NOT NULL,
    [Downtick] bigint  NOT NULL,
    [SurchargeId] bigint  NULL,
    [MenuPosition] int  NOT NULL,
    [PLU] nvarchar(max)  NULL,
    [SKU] nvarchar(max)  NULL,
    [DownTickSemaphoreIsLocked] bit  NOT NULL,
    [RevenueTypeId] bigint  NOT NULL,
    [OrderedRecipeId] bigint  NULL,
    [ExclusiveTaxRateId] bigint  NOT NULL,
    [UPC] nvarchar(max)  NULL,
    [LongName] nvarchar(max)  NULL,
    [InclusiveTaxRateId] bigint  NULL,
    [InclusiveTipRateId] bigint  NULL,
    [CalorieCount] int  NOT NULL,
    [ForcedModGroupOnExceptionModId] bigint  NULL
);
GO

-- Creating table 'FINGERPASSWORDS'
CREATE TABLE [dbo].[FINGERPASSWORDS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Data] varbinary(max)  NULL
);
GO

-- Creating table 'WORK_CENTERS'
CREATE TABLE [dbo].[WORK_CENTERS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'LOCATION_LAYOUTS'
CREATE TABLE [dbo].[LOCATION_LAYOUTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [LocationX] decimal(18,2)  NOT NULL,
    [LocationY] decimal(18,2)  NOT NULL,
    [SizeX] decimal(18,2)  NOT NULL,
    [SizeY] decimal(18,2)  NOT NULL,
    [FilePath] nvarchar(max)  NULL,
    [PageNumber] int  NOT NULL
);
GO

-- Creating table 'INCLUSIVE_TAXRATES'
CREATE TABLE [dbo].[INCLUSIVE_TAXRATES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Rate] decimal(18,6)  NOT NULL
);
GO

-- Creating table 'INCLUSIVE_TIPRATES'
CREATE TABLE [dbo].[INCLUSIVE_TIPRATES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Rate] decimal(18,6)  NOT NULL,
    [IsFlatFee] bit  NOT NULL
);
GO

-- Creating table 'SURCHARGE_ACCOUNTS'
CREATE TABLE [dbo].[SURCHARGE_ACCOUNTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsDeleted] bit  NOT NULL,
    [Rate] decimal(18,2)  NOT NULL,
    [IsFlatFee] bit  NOT NULL,
    [IsServiceCharge] bit  NOT NULL
);
GO

-- Creating table 'ORDERED_RECIPES'
CREATE TABLE [dbo].[ORDERED_RECIPES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Property] datetime  NOT NULL,
    [RecipeId] bigint  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'TRANSACTION_RESPONSES'
CREATE TABLE [dbo].[TRANSACTION_RESPONSES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [ResponseOrigin] nvarchar(max)  NULL,
    [DSIXReturnCode] nvarchar(max)  NULL,
    [CmdStatus] nvarchar(max)  NULL,
    [TextResponse] nvarchar(max)  NULL,
    [UserTraceData] nvarchar(max)  NULL,
    [SequenceNo] nvarchar(max)  NULL,
    [MerchantID] nvarchar(max)  NULL,
    [TerminalID] nvarchar(max)  NULL,
    [ExpDate] nvarchar(max)  NULL,
    [CardType] nvarchar(max)  NULL,
    [Selection] nvarchar(max)  NULL,
    [TranCode] nvarchar(max)  NULL,
    [AuthCode] nvarchar(max)  NULL,
    [AVSResult] nvarchar(max)  NULL,
    [CVVResult] nvarchar(max)  NULL,
    [VoucherNo] nvarchar(max)  NULL,
    [CaptureStatus] nvarchar(max)  NULL,
    [RefNo] nvarchar(max)  NULL,
    [InvoiceNo] nvarchar(max)  NULL,
    [OperatorID] nvarchar(max)  NULL,
    [Memo] nvarchar(max)  NULL,
    [Purchase] nvarchar(max)  NULL,
    [Authorize] nvarchar(max)  NULL,
    [Gratuity] nvarchar(max)  NULL,
    [CashBack] nvarchar(max)  NULL,
    [Balance] nvarchar(max)  NULL,
    [AcqRefData] nvarchar(max)  NULL,
    [RecordNo] nvarchar(max)  NULL,
    [IssueCurrency] nvarchar(max)  NULL,
    [IssueCurrencyPreviousBalance] nvarchar(max)  NULL,
    [IssueCurrencyEndingBalance] nvarchar(max)  NULL,
    [ExchangeRate] nvarchar(max)  NULL,
    [PrePaidExp] nvarchar(max)  NULL,
    [Language] nvarchar(max)  NULL,
    [BankRespCode] nvarchar(max)  NULL,
    [ISORespCode] nvarchar(max)  NULL,
    [TranDate] nvarchar(max)  NULL,
    [TranTime] nvarchar(max)  NULL,
    [Card4] nvarchar(max)  NULL,
    [CardKeyedOrSwiped] nvarchar(max)  NULL,
    [ReturnedToCustomer] decimal(18,2)  NOT NULL,
    [CreditCardTipFee] decimal(18,2)  NOT NULL,
    [CardRelatedTransactionID] bigint  NULL,
    [ReturnedToCustomerPaidOutId] bigint  NULL,
    [ProcessData] nvarchar(max)  NULL
);
GO

-- Creating table 'CACHES'
CREATE TABLE [dbo].[CACHES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [BinP] varbinary(max)  NULL,
    [BinE] varbinary(max)  NULL,
    [DateTime] datetime  NOT NULL
);
GO

-- Creating table 'PAYMENT_REASONS'
CREATE TABLE [dbo].[PAYMENT_REASONS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [IsPaidIn] bit  NOT NULL,
    [IsDeleted] bit  NOT NULL
);
GO

-- Creating table 'BATCH_CLOSE_RESPONSES'
CREATE TABLE [dbo].[BATCH_CLOSE_RESPONSES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [ResponseOrigin] nvarchar(max)  NULL,
    [DSIXReturnCode] nvarchar(max)  NULL,
    [CmdStatus] nvarchar(max)  NULL,
    [TextResponse] nvarchar(max)  NULL,
    [SequenceNo] nvarchar(max)  NULL,
    [UserTraceData] nvarchar(max)  NULL,
    [MerchantID] nvarchar(max)  NULL,
    [TerminalID] nvarchar(max)  NULL,
    [OperatorID] nvarchar(max)  NULL,
    [BatchNo] nvarchar(max)  NULL,
    [BatchItemCount] nvarchar(max)  NULL,
    [NetBatchTotal] nvarchar(max)  NULL,
    [CreditPurchaseCount] nvarchar(max)  NULL,
    [CreditPurchaseAmount] nvarchar(max)  NULL,
    [CreditReturnCount] nvarchar(max)  NULL,
    [CreditReturnAmount] nvarchar(max)  NULL,
    [DebitPurchaseCount] nvarchar(max)  NULL,
    [DebitPurchaseAmount] nvarchar(max)  NULL,
    [DebitReturnCount] nvarchar(max)  NULL,
    [DebitReturnAmount] nvarchar(max)  NULL,
    [ControlNo] nvarchar(max)  NULL
);
GO

-- Creating table 'BATCH_SUMMARY_RESPONSES'
CREATE TABLE [dbo].[BATCH_SUMMARY_RESPONSES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [ResponseOrigin] nvarchar(max)  NULL,
    [DSIXReturnCode] nvarchar(max)  NULL,
    [CmdStatus] nvarchar(max)  NULL,
    [TextResponse] nvarchar(max)  NULL,
    [SequenceNo] nvarchar(max)  NULL,
    [UserTraceData] nvarchar(max)  NULL,
    [MerchantID] nvarchar(max)  NULL,
    [TerminalID] nvarchar(max)  NULL,
    [OperatorID] nvarchar(max)  NULL,
    [BatchNo] nvarchar(max)  NULL,
    [BatchItemCount] nvarchar(max)  NULL,
    [NetBatchTotal] nvarchar(max)  NULL,
    [CreditPurchaseCount] nvarchar(max)  NULL,
    [CreditPurchaseAmount] nvarchar(max)  NULL,
    [CreditReturnCount] nvarchar(max)  NULL,
    [CreditReturnAmount] nvarchar(max)  NULL,
    [DebitPurchaseCount] nvarchar(max)  NULL,
    [DebitPurchaseAmount] nvarchar(max)  NULL,
    [DebitReturnCount] nvarchar(max)  NULL,
    [DebitReturnAmount] nvarchar(max)  NULL
);
GO

-- Creating table 'PRODUCT_GROUP_PRINTER_EXCLUSIONS'
CREATE TABLE [dbo].[PRODUCT_GROUP_PRINTER_EXCLUSIONS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [NavKioskId] bigint  NOT NULL,
    [ProductGroupId] bigint  NOT NULL
);
GO

-- Creating table 'ATTACHED_DEVICES'
CREATE TABLE [dbo].[ATTACHED_DEVICES] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [TypeId] bigint  NOT NULL,
    [DeviceId] bigint  NOT NULL,
    [VendorId] bigint  NOT NULL,
    [PortName] nvarchar(max)  NULL,
    [Spare64] bigint  NOT NULL
);
GO

-- Creating table 'CRON_JOBS'
CREATE TABLE [dbo].[CRON_JOBS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [TypeId] bigint  NOT NULL,
    [StringParam1] nvarchar(max)  NULL,
    [StringParam2] nvarchar(max)  NULL,
    [StringParam3] nvarchar(max)  NULL,
    [Int64Param1] bigint  NULL,
    [Int64Param2] bigint  NULL,
    [Int64Param3] bigint  NULL,
    [StartTime] datetime  NOT NULL,
    [IntervalMinutes] bigint  NULL,
    [TimesPerDay] bigint  NOT NULL,
    [DateTimeSpare1] datetime  NULL,
    [DateTimeSpare2] datetime  NULL,
    [StringParam4] nvarchar(max)  NULL
);
GO

-- Creating table 'PAGELAYOUTS'
CREATE TABLE [dbo].[PAGELAYOUTS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [PagedId] int  NOT NULL,
    [ObjectId] bigint  NOT NULL
);
GO

-- Creating table 'LAYOUTOBJS'
CREATE TABLE [dbo].[LAYOUTOBJS] (
    [Id] bigint IDENTITY(1,1) NOT NULL,
    [Height] decimal(18,0)  NOT NULL,
    [Width] decimal(18,0)  NOT NULL,
    [X] decimal(18,0)  NOT NULL,
    [Y] decimal(18,0)  NOT NULL,
    [Image] nvarchar(max)  NULL,
    [Foreground] nvarchar(max)  NULL,
    [BackgroundStart] nvarchar(max)  NULL,
    [BackgroundEnd] nvarchar(max)  NULL,
    [FunctionNumber] int  NOT NULL,
    [SpareString] nvarchar(max)  NULL,
    [ProductId] bigint  NULL,
    [CategoryId] bigint  NULL,
    [SpareId] bigint  NULL,
    [Style] nvarchar(max)  NULL,
    [Tag] nvarchar(max)  NULL,
    [PagedId] int  NULL,
    [ButtonText] nvarchar(max)  NULL
);
GO

-- Creating table 'ASSN_MENU_PRODUCT_GROUP'
CREATE TABLE [dbo].[ASSN_MENU_PRODUCT_GROUP] (
    [ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP_Id] bigint  NOT NULL,
    [PRODUCT_GROUPS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP'
CREATE TABLE [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP] (
    [ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP_Id] bigint  NOT NULL,
    [EXCEPTION_MODIFIER_GROUPS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_PRICE_INTERVAL_PRODUCT_GROUP'
CREATE TABLE [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP] (
    [PRICE_INTERVAL_DISCOUNTS_Id] bigint  NOT NULL,
    [ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_MENU_GROUP_MENU'
CREATE TABLE [dbo].[ASSN_MENU_GROUP_MENU] (
    [ASSN_MENU_GROUP_MENU_MENU_Id] bigint  NOT NULL,
    [MENUS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_KIOSK_AUTO_GRATUITY'
CREATE TABLE [dbo].[ASSN_KIOSK_AUTO_GRATUITY] (
    [ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY_Id] bigint  NOT NULL,
    [AUTO_GRATUITYS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER'
CREATE TABLE [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER] (
    [ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_Id] bigint  NOT NULL,
    [FORCED_MODIFIERS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER'
CREATE TABLE [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER] (
    [ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_Id] bigint  NOT NULL,
    [EXCEPTION_MODIFIERS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_PRODUCT_GROUP_PRODUCT'
CREATE TABLE [dbo].[ASSN_PRODUCT_GROUP_PRODUCT] (
    [ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_Id] bigint  NOT NULL,
    [PRODUCTS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_PRODUCT_FORCED_MODIFIER_GROUP'
CREATE TABLE [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP] (
    [ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP_Id] bigint  NOT NULL,
    [FORCED_MODIFIER_GROUPS_Id] bigint  NOT NULL
);
GO

-- Creating table 'ASSN_PRINTER_GROUP_PRINTER'
CREATE TABLE [dbo].[ASSN_PRINTER_GROUP_PRINTER] (
    [ASSN_PRINTER_GROUP_PRINTER_PRINTER_Id] bigint  NOT NULL,
    [PRINTERS_Id] bigint  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [Id] in table 'USERS'
ALTER TABLE [dbo].[USERS]
ADD CONSTRAINT [PK_USERS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'JOB_CODES'
ALTER TABLE [dbo].[JOB_CODES]
ADD CONSTRAINT [PK_JOB_CODES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'ACCESS_LEVELS'
ALTER TABLE [dbo].[ACCESS_LEVELS]
ADD CONSTRAINT [PK_ACCESS_LEVELS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PAYGRADES'
ALTER TABLE [dbo].[PAYGRADES]
ADD CONSTRAINT [PK_PAYGRADES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'ROLES'
ALTER TABLE [dbo].[ROLES]
ADD CONSTRAINT [PK_ROLES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'MENUS'
ALTER TABLE [dbo].[MENUS]
ADD CONSTRAINT [PK_MENUS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PRODUCT_GROUPS'
ALTER TABLE [dbo].[PRODUCT_GROUPS]
ADD CONSTRAINT [PK_PRODUCT_GROUPS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'FORCED_MODIFIER_GROUPS'
ALTER TABLE [dbo].[FORCED_MODIFIER_GROUPS]
ADD CONSTRAINT [PK_FORCED_MODIFIER_GROUPS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'ORDERS'
ALTER TABLE [dbo].[ORDERS]
ADD CONSTRAINT [PK_ORDERS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'EXCEPTION_MODIFIER_GROUPS'
ALTER TABLE [dbo].[EXCEPTION_MODIFIER_GROUPS]
ADD CONSTRAINT [PK_EXCEPTION_MODIFIER_GROUPS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PRICE_INTERVAL_DISCOUNTS'
ALTER TABLE [dbo].[PRICE_INTERVAL_DISCOUNTS]
ADD CONSTRAINT [PK_PRICE_INTERVAL_DISCOUNTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'TIMESLIPS'
ALTER TABLE [dbo].[TIMESLIPS]
ADD CONSTRAINT [PK_TIMESLIPS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'TRANSACTIONS'
ALTER TABLE [dbo].[TRANSACTIONS]
ADD CONSTRAINT [PK_TRANSACTIONS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'SYSCONFIGS'
ALTER TABLE [dbo].[SYSCONFIGS]
ADD CONSTRAINT [PK_SYSCONFIGS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'KIOSKS'
ALTER TABLE [dbo].[KIOSKS]
ADD CONSTRAINT [PK_KIOSKS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS'
ALTER TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
ADD CONSTRAINT [PK_MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'SHIFTS'
ALTER TABLE [dbo].[SHIFTS]
ADD CONSTRAINT [PK_SHIFTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PROCESSORS'
ALTER TABLE [dbo].[PROCESSORS]
ADD CONSTRAINT [PK_PROCESSORS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'MENU_GROUPS'
ALTER TABLE [dbo].[MENU_GROUPS]
ADD CONSTRAINT [PK_MENU_GROUPS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PCILOGS'
ALTER TABLE [dbo].[PCILOGS]
ADD CONSTRAINT [PK_PCILOGS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'BUSINESS_DAYS'
ALTER TABLE [dbo].[BUSINESS_DAYS]
ADD CONSTRAINT [PK_BUSINESS_DAYS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PRINTERS'
ALTER TABLE [dbo].[PRINTERS]
ADD CONSTRAINT [PK_PRINTERS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PRINTER_GROUPS'
ALTER TABLE [dbo].[PRINTER_GROUPS]
ADD CONSTRAINT [PK_PRINTER_GROUPS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'SALES'
ALTER TABLE [dbo].[SALES]
ADD CONSTRAINT [PK_SALES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'AUTO_GRATUITYS'
ALTER TABLE [dbo].[AUTO_GRATUITYS]
ADD CONSTRAINT [PK_AUTO_GRATUITYS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PAYROLL_RUNS'
ALTER TABLE [dbo].[PAYROLL_RUNS]
ADD CONSTRAINT [PK_PAYROLL_RUNS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'REVENUE_TYPES'
ALTER TABLE [dbo].[REVENUE_TYPES]
ADD CONSTRAINT [PK_REVENUE_TYPES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'DAYPARTS'
ALTER TABLE [dbo].[DAYPARTS]
ADD CONSTRAINT [PK_DAYPARTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id], [AssociatedId] in table 'USER_ACTIONS_LOGS'
ALTER TABLE [dbo].[USER_ACTIONS_LOGS]
ADD CONSTRAINT [PK_USER_ACTIONS_LOGS]
    PRIMARY KEY CLUSTERED ([Id], [AssociatedId] ASC);
GO

-- Creating primary key on [Id] in table 'REVENUE_CENTERS'
ALTER TABLE [dbo].[REVENUE_CENTERS]
ADD CONSTRAINT [PK_REVENUE_CENTERS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'RECIPE_PRODUCTS'
ALTER TABLE [dbo].[RECIPE_PRODUCTS]
ADD CONSTRAINT [PK_RECIPE_PRODUCTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'INVOICE_LINE_ITEMS'
ALTER TABLE [dbo].[INVOICE_LINE_ITEMS]
ADD CONSTRAINT [PK_INVOICE_LINE_ITEMS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'RECIPES'
ALTER TABLE [dbo].[RECIPES]
ADD CONSTRAINT [PK_RECIPES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'RECIPE_INGREDIENTS'
ALTER TABLE [dbo].[RECIPE_INGREDIENTS]
ADD CONSTRAINT [PK_RECIPE_INGREDIENTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'INVENTORY_COUNT_LOGS'
ALTER TABLE [dbo].[INVENTORY_COUNT_LOGS]
ADD CONSTRAINT [PK_INVENTORY_COUNT_LOGS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'GLCODES'
ALTER TABLE [dbo].[GLCODES]
ADD CONSTRAINT [PK_GLCODES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PAYMENTS'
ALTER TABLE [dbo].[PAYMENTS]
ADD CONSTRAINT [PK_PAYMENTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'DEPOSITS'
ALTER TABLE [dbo].[DEPOSITS]
ADD CONSTRAINT [PK_DEPOSITS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'NOSALES'
ALTER TABLE [dbo].[NOSALES]
ADD CONSTRAINT [PK_NOSALES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'HOUSE_ACCOUNTS'
ALTER TABLE [dbo].[HOUSE_ACCOUNTS]
ADD CONSTRAINT [PK_HOUSE_ACCOUNTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'VENDOR_ACCOUNTS'
ALTER TABLE [dbo].[VENDOR_ACCOUNTS]
ADD CONSTRAINT [PK_VENDOR_ACCOUNTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'BREAKS'
ALTER TABLE [dbo].[BREAKS]
ADD CONSTRAINT [PK_BREAKS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'GIFT_CARDS_SOLDS'
ALTER TABLE [dbo].[GIFT_CARDS_SOLDS]
ADD CONSTRAINT [PK_GIFT_CARDS_SOLDS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'SPECIALPAYS'
ALTER TABLE [dbo].[SPECIALPAYS]
ADD CONSTRAINT [PK_SPECIALPAYS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'EXCLUSIVE_TAXRATES'
ALTER TABLE [dbo].[EXCLUSIVE_TAXRATES]
ADD CONSTRAINT [PK_EXCLUSIVE_TAXRATES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'CASH_TRANSACTIONS'
ALTER TABLE [dbo].[CASH_TRANSACTIONS]
ADD CONSTRAINT [PK_CASH_TRANSACTIONS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'COMP_ACCOUNTS'
ALTER TABLE [dbo].[COMP_ACCOUNTS]
ADD CONSTRAINT [PK_COMP_ACCOUNTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'HOUSE_TRANSACTIONS'
ALTER TABLE [dbo].[HOUSE_TRANSACTIONS]
ADD CONSTRAINT [PK_HOUSE_TRANSACTIONS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'SCHEDULES'
ALTER TABLE [dbo].[SCHEDULES]
ADD CONSTRAINT [PK_SCHEDULES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'FORCED_MODIFIERS'
ALTER TABLE [dbo].[FORCED_MODIFIERS]
ADD CONSTRAINT [PK_FORCED_MODIFIERS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PRODUCTS'
ALTER TABLE [dbo].[PRODUCTS]
ADD CONSTRAINT [PK_PRODUCTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'EXCEPTION_MODIFIERS'
ALTER TABLE [dbo].[EXCEPTION_MODIFIERS]
ADD CONSTRAINT [PK_EXCEPTION_MODIFIERS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'FINGERPASSWORDS'
ALTER TABLE [dbo].[FINGERPASSWORDS]
ADD CONSTRAINT [PK_FINGERPASSWORDS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'WORK_CENTERS'
ALTER TABLE [dbo].[WORK_CENTERS]
ADD CONSTRAINT [PK_WORK_CENTERS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'LOCATION_LAYOUTS'
ALTER TABLE [dbo].[LOCATION_LAYOUTS]
ADD CONSTRAINT [PK_LOCATION_LAYOUTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'INCLUSIVE_TAXRATES'
ALTER TABLE [dbo].[INCLUSIVE_TAXRATES]
ADD CONSTRAINT [PK_INCLUSIVE_TAXRATES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'INCLUSIVE_TIPRATES'
ALTER TABLE [dbo].[INCLUSIVE_TIPRATES]
ADD CONSTRAINT [PK_INCLUSIVE_TIPRATES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'SURCHARGE_ACCOUNTS'
ALTER TABLE [dbo].[SURCHARGE_ACCOUNTS]
ADD CONSTRAINT [PK_SURCHARGE_ACCOUNTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'ORDERED_RECIPES'
ALTER TABLE [dbo].[ORDERED_RECIPES]
ADD CONSTRAINT [PK_ORDERED_RECIPES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'TRANSACTION_RESPONSES'
ALTER TABLE [dbo].[TRANSACTION_RESPONSES]
ADD CONSTRAINT [PK_TRANSACTION_RESPONSES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'CACHES'
ALTER TABLE [dbo].[CACHES]
ADD CONSTRAINT [PK_CACHES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PAYMENT_REASONS'
ALTER TABLE [dbo].[PAYMENT_REASONS]
ADD CONSTRAINT [PK_PAYMENT_REASONS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'BATCH_CLOSE_RESPONSES'
ALTER TABLE [dbo].[BATCH_CLOSE_RESPONSES]
ADD CONSTRAINT [PK_BATCH_CLOSE_RESPONSES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'BATCH_SUMMARY_RESPONSES'
ALTER TABLE [dbo].[BATCH_SUMMARY_RESPONSES]
ADD CONSTRAINT [PK_BATCH_SUMMARY_RESPONSES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PRODUCT_GROUP_PRINTER_EXCLUSIONS'
ALTER TABLE [dbo].[PRODUCT_GROUP_PRINTER_EXCLUSIONS]
ADD CONSTRAINT [PK_PRODUCT_GROUP_PRINTER_EXCLUSIONS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'ATTACHED_DEVICES'
ALTER TABLE [dbo].[ATTACHED_DEVICES]
ADD CONSTRAINT [PK_ATTACHED_DEVICES]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'CRON_JOBS'
ALTER TABLE [dbo].[CRON_JOBS]
ADD CONSTRAINT [PK_CRON_JOBS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'PAGELAYOUTS'
ALTER TABLE [dbo].[PAGELAYOUTS]
ADD CONSTRAINT [PK_PAGELAYOUTS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [Id] in table 'LAYOUTOBJS'
ALTER TABLE [dbo].[LAYOUTOBJS]
ADD CONSTRAINT [PK_LAYOUTOBJS]
    PRIMARY KEY CLUSTERED ([Id] ASC);
GO

-- Creating primary key on [ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP_Id], [PRODUCT_GROUPS_Id] in table 'ASSN_MENU_PRODUCT_GROUP'
ALTER TABLE [dbo].[ASSN_MENU_PRODUCT_GROUP]
ADD CONSTRAINT [PK_ASSN_MENU_PRODUCT_GROUP]
    PRIMARY KEY NONCLUSTERED ([ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP_Id], [PRODUCT_GROUPS_Id] ASC);
GO

-- Creating primary key on [ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP_Id], [EXCEPTION_MODIFIER_GROUPS_Id] in table 'ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP'
ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP]
ADD CONSTRAINT [PK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP]
    PRIMARY KEY NONCLUSTERED ([ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP_Id], [EXCEPTION_MODIFIER_GROUPS_Id] ASC);
GO

-- Creating primary key on [PRICE_INTERVAL_DISCOUNTS_Id], [ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL_Id] in table 'ASSN_PRICE_INTERVAL_PRODUCT_GROUP'
ALTER TABLE [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP]
ADD CONSTRAINT [PK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP]
    PRIMARY KEY NONCLUSTERED ([PRICE_INTERVAL_DISCOUNTS_Id], [ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL_Id] ASC);
GO

-- Creating primary key on [ASSN_MENU_GROUP_MENU_MENU_Id], [MENUS_Id] in table 'ASSN_MENU_GROUP_MENU'
ALTER TABLE [dbo].[ASSN_MENU_GROUP_MENU]
ADD CONSTRAINT [PK_ASSN_MENU_GROUP_MENU]
    PRIMARY KEY NONCLUSTERED ([ASSN_MENU_GROUP_MENU_MENU_Id], [MENUS_Id] ASC);
GO

-- Creating primary key on [ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY_Id], [AUTO_GRATUITYS_Id] in table 'ASSN_KIOSK_AUTO_GRATUITY'
ALTER TABLE [dbo].[ASSN_KIOSK_AUTO_GRATUITY]
ADD CONSTRAINT [PK_ASSN_KIOSK_AUTO_GRATUITY]
    PRIMARY KEY NONCLUSTERED ([ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY_Id], [AUTO_GRATUITYS_Id] ASC);
GO

-- Creating primary key on [ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_Id], [FORCED_MODIFIERS_Id] in table 'ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER'
ALTER TABLE [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER]
ADD CONSTRAINT [PK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER]
    PRIMARY KEY NONCLUSTERED ([ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_Id], [FORCED_MODIFIERS_Id] ASC);
GO

-- Creating primary key on [ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_Id], [EXCEPTION_MODIFIERS_Id] in table 'ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER'
ALTER TABLE [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER]
ADD CONSTRAINT [PK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER]
    PRIMARY KEY NONCLUSTERED ([ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_Id], [EXCEPTION_MODIFIERS_Id] ASC);
GO

-- Creating primary key on [ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_Id], [PRODUCTS_Id] in table 'ASSN_PRODUCT_GROUP_PRODUCT'
ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_PRODUCT]
ADD CONSTRAINT [PK_ASSN_PRODUCT_GROUP_PRODUCT]
    PRIMARY KEY NONCLUSTERED ([ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_Id], [PRODUCTS_Id] ASC);
GO

-- Creating primary key on [ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP_Id], [FORCED_MODIFIER_GROUPS_Id] in table 'ASSN_PRODUCT_FORCED_MODIFIER_GROUP'
ALTER TABLE [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP]
ADD CONSTRAINT [PK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP]
    PRIMARY KEY NONCLUSTERED ([ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP_Id], [FORCED_MODIFIER_GROUPS_Id] ASC);
GO

-- Creating primary key on [ASSN_PRINTER_GROUP_PRINTER_PRINTER_Id], [PRINTERS_Id] in table 'ASSN_PRINTER_GROUP_PRINTER'
ALTER TABLE [dbo].[ASSN_PRINTER_GROUP_PRINTER]
ADD CONSTRAINT [PK_ASSN_PRINTER_GROUP_PRINTER]
    PRIMARY KEY NONCLUSTERED ([ASSN_PRINTER_GROUP_PRINTER_PRINTER_Id], [PRINTERS_Id] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [NavJobCodeId] in table 'ROLES'
ALTER TABLE [dbo].[ROLES]
ADD CONSTRAINT [FK_ASSN_JOB_CODE_ROLE]
    FOREIGN KEY ([NavJobCodeId])
    REFERENCES [dbo].[JOB_CODES]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_JOB_CODE_ROLE'
CREATE INDEX [IX_FK_ASSN_JOB_CODE_ROLE]
ON [dbo].[ROLES]
    ([NavJobCodeId]);
GO

-- Creating foreign key on [NavAccessLevelId] in table 'ROLES'
ALTER TABLE [dbo].[ROLES]
ADD CONSTRAINT [FK_ASSN_ACCESS_LEVEL_ROLE]
    FOREIGN KEY ([NavAccessLevelId])
    REFERENCES [dbo].[ACCESS_LEVELS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_ACCESS_LEVEL_ROLE'
CREATE INDEX [IX_FK_ASSN_ACCESS_LEVEL_ROLE]
ON [dbo].[ROLES]
    ([NavAccessLevelId]);
GO

-- Creating foreign key on [UserId] in table 'ROLES'
ALTER TABLE [dbo].[ROLES]
ADD CONSTRAINT [FK_ASSN_USER_ROLE]
    FOREIGN KEY ([UserId])
    REFERENCES [dbo].[USERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_USER_ROLE'
CREATE INDEX [IX_FK_ASSN_USER_ROLE]
ON [dbo].[ROLES]
    ([UserId]);
GO

-- Creating foreign key on [ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP_Id] in table 'ASSN_MENU_PRODUCT_GROUP'
ALTER TABLE [dbo].[ASSN_MENU_PRODUCT_GROUP]
ADD CONSTRAINT [FK_ASSN_MENU_PRODUCT_GROUP_MENU]
    FOREIGN KEY ([ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP_Id])
    REFERENCES [dbo].[MENUS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [PRODUCT_GROUPS_Id] in table 'ASSN_MENU_PRODUCT_GROUP'
ALTER TABLE [dbo].[ASSN_MENU_PRODUCT_GROUP]
ADD CONSTRAINT [FK_ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP]
    FOREIGN KEY ([PRODUCT_GROUPS_Id])
    REFERENCES [dbo].[PRODUCT_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP'
CREATE INDEX [IX_FK_ASSN_MENU_PRODUCT_GROUP_PRODUCT_GROUP]
ON [dbo].[ASSN_MENU_PRODUCT_GROUP]
    ([PRODUCT_GROUPS_Id]);
GO

-- Creating foreign key on [NavPaygradeId] in table 'ROLES'
ALTER TABLE [dbo].[ROLES]
ADD CONSTRAINT [FK_ASSN_PAYGRADE_ROLE]
    FOREIGN KEY ([NavPaygradeId])
    REFERENCES [dbo].[PAYGRADES]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_PAYGRADE_ROLE'
CREATE INDEX [IX_FK_ASSN_PAYGRADE_ROLE]
ON [dbo].[ROLES]
    ([NavPaygradeId]);
GO

-- Creating foreign key on [ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP_Id] in table 'ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP'
ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP]
ADD CONSTRAINT [FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_PRODUCT_GROUP]
    FOREIGN KEY ([ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP_Id])
    REFERENCES [dbo].[PRODUCT_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [EXCEPTION_MODIFIER_GROUPS_Id] in table 'ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP'
ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP]
ADD CONSTRAINT [FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP]
    FOREIGN KEY ([EXCEPTION_MODIFIER_GROUPS_Id])
    REFERENCES [dbo].[EXCEPTION_MODIFIER_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP'
CREATE INDEX [IX_FK_ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_GROUP]
ON [dbo].[ASSN_PRODUCT_GROUP_EXCEPTION_MODIFIER_GROUP]
    ([EXCEPTION_MODIFIER_GROUPS_Id]);
GO

-- Creating foreign key on [PRICE_INTERVAL_DISCOUNTS_Id] in table 'ASSN_PRICE_INTERVAL_PRODUCT_GROUP'
ALTER TABLE [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP]
ADD CONSTRAINT [FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL]
    FOREIGN KEY ([PRICE_INTERVAL_DISCOUNTS_Id])
    REFERENCES [dbo].[PRICE_INTERVAL_DISCOUNTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL_Id] in table 'ASSN_PRICE_INTERVAL_PRODUCT_GROUP'
ALTER TABLE [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP]
ADD CONSTRAINT [FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRODUCT_GROUP]
    FOREIGN KEY ([ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL_Id])
    REFERENCES [dbo].[PRODUCT_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRODUCT_GROUP'
CREATE INDEX [IX_FK_ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRODUCT_GROUP]
ON [dbo].[ASSN_PRICE_INTERVAL_PRODUCT_GROUP]
    ([ASSN_PRICE_INTERVAL_PRODUCT_GROUP_PRICE_INTERVAL_Id]);
GO

-- Creating foreign key on [NavKioskId] in table 'MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS'
ALTER TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
ADD CONSTRAINT [FK_ASSN_MAP_JOIN_WITH_KIOSK]
    FOREIGN KEY ([NavKioskId])
    REFERENCES [dbo].[KIOSKS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_MAP_JOIN_WITH_KIOSK'
CREATE INDEX [IX_FK_ASSN_MAP_JOIN_WITH_KIOSK]
ON [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
    ([NavKioskId]);
GO

-- Creating foreign key on [NavProductGroupId] in table 'MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS'
ALTER TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
ADD CONSTRAINT [FK_ASSN_MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUP]
    FOREIGN KEY ([NavProductGroupId])
    REFERENCES [dbo].[PRODUCT_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUP'
CREATE INDEX [IX_FK_ASSN_MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUP]
ON [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
    ([NavProductGroupId]);
GO

-- Creating foreign key on [ASSN_MENU_GROUP_MENU_MENU_Id] in table 'ASSN_MENU_GROUP_MENU'
ALTER TABLE [dbo].[ASSN_MENU_GROUP_MENU]
ADD CONSTRAINT [FK_ASSN_MENU_GROUP_MENU_MENU_GROUP]
    FOREIGN KEY ([ASSN_MENU_GROUP_MENU_MENU_Id])
    REFERENCES [dbo].[MENU_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [MENUS_Id] in table 'ASSN_MENU_GROUP_MENU'
ALTER TABLE [dbo].[ASSN_MENU_GROUP_MENU]
ADD CONSTRAINT [FK_ASSN_MENU_GROUP_MENU_MENU]
    FOREIGN KEY ([MENUS_Id])
    REFERENCES [dbo].[MENUS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_MENU_GROUP_MENU_MENU'
CREATE INDEX [IX_FK_ASSN_MENU_GROUP_MENU_MENU]
ON [dbo].[ASSN_MENU_GROUP_MENU]
    ([MENUS_Id]);
GO

-- Creating foreign key on [ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY_Id] in table 'ASSN_KIOSK_AUTO_GRATUITY'
ALTER TABLE [dbo].[ASSN_KIOSK_AUTO_GRATUITY]
ADD CONSTRAINT [FK_ASSN_KIOSK_AUTO_GRATUITY_NODE]
    FOREIGN KEY ([ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY_Id])
    REFERENCES [dbo].[KIOSKS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [AUTO_GRATUITYS_Id] in table 'ASSN_KIOSK_AUTO_GRATUITY'
ALTER TABLE [dbo].[ASSN_KIOSK_AUTO_GRATUITY]
ADD CONSTRAINT [FK_ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY]
    FOREIGN KEY ([AUTO_GRATUITYS_Id])
    REFERENCES [dbo].[AUTO_GRATUITYS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY'
CREATE INDEX [IX_FK_ASSN_KIOSK_AUTO_GRATUITY_AUTO_GRATUITY]
ON [dbo].[ASSN_KIOSK_AUTO_GRATUITY]
    ([AUTO_GRATUITYS_Id]);
GO

-- Creating foreign key on [NavOrderId] in table 'NOSALES'
ALTER TABLE [dbo].[NOSALES]
ADD CONSTRAINT [FK_ASSN_NOSALE_ORDER]
    FOREIGN KEY ([NavOrderId])
    REFERENCES [dbo].[ORDERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_NOSALE_ORDER'
CREATE INDEX [IX_FK_ASSN_NOSALE_ORDER]
ON [dbo].[NOSALES]
    ([NavOrderId]);
GO

-- Creating foreign key on [NavVendorAccountId] in table 'INVOICE_LINE_ITEMS'
ALTER TABLE [dbo].[INVOICE_LINE_ITEMS]
ADD CONSTRAINT [FK_ASSN_INVOICE_LINE_ITEM_VENDOR_ACCOUNT]
    FOREIGN KEY ([NavVendorAccountId])
    REFERENCES [dbo].[VENDOR_ACCOUNTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_INVOICE_LINE_ITEM_VENDOR_ACCOUNT'
CREATE INDEX [IX_FK_ASSN_INVOICE_LINE_ITEM_VENDOR_ACCOUNT]
ON [dbo].[INVOICE_LINE_ITEMS]
    ([NavVendorAccountId]);
GO

-- Creating foreign key on [TIMESLIP_Id] in table 'SPECIALPAYS'
ALTER TABLE [dbo].[SPECIALPAYS]
ADD CONSTRAINT [FK_ASSN_TIMESLIP_SPECIALPAY]
    FOREIGN KEY ([TIMESLIP_Id])
    REFERENCES [dbo].[TIMESLIPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_TIMESLIP_SPECIALPAY'
CREATE INDEX [IX_FK_ASSN_TIMESLIP_SPECIALPAY]
ON [dbo].[SPECIALPAYS]
    ([TIMESLIP_Id]);
GO

-- Creating foreign key on [ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_Id] in table 'ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER'
ALTER TABLE [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER]
ADD CONSTRAINT [FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_GROUP]
    FOREIGN KEY ([ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER_Id])
    REFERENCES [dbo].[FORCED_MODIFIER_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [FORCED_MODIFIERS_Id] in table 'ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER'
ALTER TABLE [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER]
ADD CONSTRAINT [FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER]
    FOREIGN KEY ([FORCED_MODIFIERS_Id])
    REFERENCES [dbo].[FORCED_MODIFIERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER'
CREATE INDEX [IX_FK_ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_FORCED_MODIFIER]
ON [dbo].[ASSN_FORCED_MODIFIER_GROUP_FORCED_MODIFIER]
    ([FORCED_MODIFIERS_Id]);
GO

-- Creating foreign key on [ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_Id] in table 'ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER'
ALTER TABLE [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER]
ADD CONSTRAINT [FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_GROUP]
    FOREIGN KEY ([ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER_Id])
    REFERENCES [dbo].[EXCEPTION_MODIFIER_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [EXCEPTION_MODIFIERS_Id] in table 'ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER'
ALTER TABLE [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER]
ADD CONSTRAINT [FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER]
    FOREIGN KEY ([EXCEPTION_MODIFIERS_Id])
    REFERENCES [dbo].[EXCEPTION_MODIFIERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER'
CREATE INDEX [IX_FK_ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER_EXCEPTION_MODIFIER]
ON [dbo].[ASSN_EXCEPTION_MODIFIER_GROUP_EXCEPTION_MODIFIER]
    ([EXCEPTION_MODIFIERS_Id]);
GO

-- Creating foreign key on [ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_Id] in table 'ASSN_PRODUCT_GROUP_PRODUCT'
ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_PRODUCT]
ADD CONSTRAINT [FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_GROUP]
    FOREIGN KEY ([ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT_Id])
    REFERENCES [dbo].[PRODUCT_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [PRODUCTS_Id] in table 'ASSN_PRODUCT_GROUP_PRODUCT'
ALTER TABLE [dbo].[ASSN_PRODUCT_GROUP_PRODUCT]
ADD CONSTRAINT [FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT]
    FOREIGN KEY ([PRODUCTS_Id])
    REFERENCES [dbo].[PRODUCTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT'
CREATE INDEX [IX_FK_ASSN_PRODUCT_GROUP_PRODUCT_PRODUCT]
ON [dbo].[ASSN_PRODUCT_GROUP_PRODUCT]
    ([PRODUCTS_Id]);
GO

-- Creating foreign key on [NavOrderId] in table 'TRANSACTIONS'
ALTER TABLE [dbo].[TRANSACTIONS]
ADD CONSTRAINT [FK_ASSN_ORDERPAYMENT]
    FOREIGN KEY ([NavOrderId])
    REFERENCES [dbo].[ORDERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_ORDERPAYMENT'
CREATE INDEX [IX_FK_ASSN_ORDERPAYMENT]
ON [dbo].[TRANSACTIONS]
    ([NavOrderId]);
GO

-- Creating foreign key on [SHIFT_Id] in table 'TIMESLIPS'
ALTER TABLE [dbo].[TIMESLIPS]
ADD CONSTRAINT [FK_ASSN_TIMESLIP_SHIFT]
    FOREIGN KEY ([SHIFT_Id])
    REFERENCES [dbo].[SHIFTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_TIMESLIP_SHIFT'
CREATE INDEX [IX_FK_ASSN_TIMESLIP_SHIFT]
ON [dbo].[TIMESLIPS]
    ([SHIFT_Id]);
GO

-- Creating foreign key on [NavOrderId] in table 'SALES'
ALTER TABLE [dbo].[SALES]
ADD CONSTRAINT [FK_ASSN_ORDERSALE]
    FOREIGN KEY ([NavOrderId])
    REFERENCES [dbo].[ORDERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_ORDERSALE'
CREATE INDEX [IX_FK_ASSN_ORDERSALE]
ON [dbo].[SALES]
    ([NavOrderId]);
GO

-- Creating foreign key on [NavEmployeeShiftId] in table 'ORDERS'
ALTER TABLE [dbo].[ORDERS]
ADD CONSTRAINT [FK_ASSN_SHIFT_ORDER]
    FOREIGN KEY ([NavEmployeeShiftId])
    REFERENCES [dbo].[SHIFTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_SHIFT_ORDER'
CREATE INDEX [IX_FK_ASSN_SHIFT_ORDER]
ON [dbo].[ORDERS]
    ([NavEmployeeShiftId]);
GO

-- Creating foreign key on [NavEmployeeShiftId] in table 'PAYMENTS'
ALTER TABLE [dbo].[PAYMENTS]
ADD CONSTRAINT [FK_ASSN_SHIFT_PAYMENTS]
    FOREIGN KEY ([NavEmployeeShiftId])
    REFERENCES [dbo].[SHIFTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_SHIFT_PAYMENTS'
CREATE INDEX [IX_FK_ASSN_SHIFT_PAYMENTS]
ON [dbo].[PAYMENTS]
    ([NavEmployeeShiftId]);
GO

-- Creating foreign key on [NavOrderId] in table 'GIFT_CARDS_SOLDS'
ALTER TABLE [dbo].[GIFT_CARDS_SOLDS]
ADD CONSTRAINT [FK_ASSN_ORDER_GIFT_CARDS_SOLD]
    FOREIGN KEY ([NavOrderId])
    REFERENCES [dbo].[ORDERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_ORDER_GIFT_CARDS_SOLD'
CREATE INDEX [IX_FK_ASSN_ORDER_GIFT_CARDS_SOLD]
ON [dbo].[GIFT_CARDS_SOLDS]
    ([NavOrderId]);
GO

-- Creating foreign key on [NavWorkCenterId] in table 'SCHEDULES'
ALTER TABLE [dbo].[SCHEDULES]
ADD CONSTRAINT [FK_SCHEDULE_WORK_CENTER]
    FOREIGN KEY ([NavWorkCenterId])
    REFERENCES [dbo].[WORK_CENTERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SCHEDULE_WORK_CENTER'
CREATE INDEX [IX_FK_SCHEDULE_WORK_CENTER]
ON [dbo].[SCHEDULES]
    ([NavWorkCenterId]);
GO

-- Creating foreign key on [ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP_Id] in table 'ASSN_PRODUCT_FORCED_MODIFIER_GROUP'
ALTER TABLE [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP]
ADD CONSTRAINT [FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_PRODUCT]
    FOREIGN KEY ([ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP_Id])
    REFERENCES [dbo].[PRODUCTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [FORCED_MODIFIER_GROUPS_Id] in table 'ASSN_PRODUCT_FORCED_MODIFIER_GROUP'
ALTER TABLE [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP]
ADD CONSTRAINT [FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP]
    FOREIGN KEY ([FORCED_MODIFIER_GROUPS_Id])
    REFERENCES [dbo].[FORCED_MODIFIER_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP'
CREATE INDEX [IX_FK_ASSN_PRODUCT_FORCED_MODIFIER_GROUP_FORCED_MODIFIER_GROUP]
ON [dbo].[ASSN_PRODUCT_FORCED_MODIFIER_GROUP]
    ([FORCED_MODIFIER_GROUPS_Id]);
GO

-- Creating foreign key on [ASSN_PRINTER_GROUP_PRINTER_PRINTER_Id] in table 'ASSN_PRINTER_GROUP_PRINTER'
ALTER TABLE [dbo].[ASSN_PRINTER_GROUP_PRINTER]
ADD CONSTRAINT [FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER_GROUP]
    FOREIGN KEY ([ASSN_PRINTER_GROUP_PRINTER_PRINTER_Id])
    REFERENCES [dbo].[PRINTER_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;
GO

-- Creating foreign key on [PRINTERS_Id] in table 'ASSN_PRINTER_GROUP_PRINTER'
ALTER TABLE [dbo].[ASSN_PRINTER_GROUP_PRINTER]
ADD CONSTRAINT [FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER]
    FOREIGN KEY ([PRINTERS_Id])
    REFERENCES [dbo].[PRINTERS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER'
CREATE INDEX [IX_FK_ASSN_PRINTER_GROUP_PRINTER_PRINTER]
ON [dbo].[ASSN_PRINTER_GROUP_PRINTER]
    ([PRINTERS_Id]);
GO

-- Creating foreign key on [NavRecipeProductId] in table 'INVENTORY_COUNT_LOGS'
ALTER TABLE [dbo].[INVENTORY_COUNT_LOGS]
ADD CONSTRAINT [FK_ASSN_RECIPE_PRODUCT_INVENTORY_COUNT_LOG]
    FOREIGN KEY ([NavRecipeProductId])
    REFERENCES [dbo].[RECIPE_PRODUCTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_RECIPE_PRODUCT_INVENTORY_COUNT_LOG'
CREATE INDEX [IX_FK_ASSN_RECIPE_PRODUCT_INVENTORY_COUNT_LOG]
ON [dbo].[INVENTORY_COUNT_LOGS]
    ([NavRecipeProductId]);
GO

-- Creating foreign key on [NavRecipeProductId] in table 'RECIPE_INGREDIENTS'
ALTER TABLE [dbo].[RECIPE_INGREDIENTS]
ADD CONSTRAINT [FK_ASSN_RECIPE_INGREDIENT_RECIPE_PRODUCT]
    FOREIGN KEY ([NavRecipeProductId])
    REFERENCES [dbo].[RECIPE_PRODUCTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_RECIPE_INGREDIENT_RECIPE_PRODUCT'
CREATE INDEX [IX_FK_ASSN_RECIPE_INGREDIENT_RECIPE_PRODUCT]
ON [dbo].[RECIPE_INGREDIENTS]
    ([NavRecipeProductId]);
GO

-- Creating foreign key on [NavRecipeId] in table 'RECIPE_INGREDIENTS'
ALTER TABLE [dbo].[RECIPE_INGREDIENTS]
ADD CONSTRAINT [FK_ASSN_RECIPE_INGREDIENT_RECIPE]
    FOREIGN KEY ([NavRecipeId])
    REFERENCES [dbo].[RECIPES]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_RECIPE_INGREDIENT_RECIPE'
CREATE INDEX [IX_FK_ASSN_RECIPE_INGREDIENT_RECIPE]
ON [dbo].[RECIPE_INGREDIENTS]
    ([NavRecipeId]);
GO

-- Creating foreign key on [NavPrinterGroupId] in table 'MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS'
ALTER TABLE [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
ADD CONSTRAINT [FK_ASSN_MAP_JOIN_WITH_PRINTER_GROUP]
    FOREIGN KEY ([NavPrinterGroupId])
    REFERENCES [dbo].[PRINTER_GROUPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_MAP_JOIN_WITH_PRINTER_GROUP'
CREATE INDEX [IX_FK_ASSN_MAP_JOIN_WITH_PRINTER_GROUP]
ON [dbo].[MAP_KIOSK_PRODUCT_GROUP_AND_PRINTER_GROUPS]
    ([NavPrinterGroupId]);
GO

-- Creating foreign key on [NavTimePunchId] in table 'BREAKS'
ALTER TABLE [dbo].[BREAKS]
ADD CONSTRAINT [FK_ASSN_TIMESLIP_BREAK]
    FOREIGN KEY ([NavTimePunchId])
    REFERENCES [dbo].[TIMESLIPS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_TIMESLIP_BREAK'
CREATE INDEX [IX_FK_ASSN_TIMESLIP_BREAK]
ON [dbo].[BREAKS]
    ([NavTimePunchId]);
GO

-- Creating foreign key on [NavParentSaleWhenModSaleId] in table 'SALES'
ALTER TABLE [dbo].[SALES]
ADD CONSTRAINT [FK_ASSN_PARENTSALE_WHEN_MODSALE]
    FOREIGN KEY ([NavParentSaleWhenModSaleId])
    REFERENCES [dbo].[SALES]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_PARENTSALE_WHEN_MODSALE'
CREATE INDEX [IX_FK_ASSN_PARENTSALE_WHEN_MODSALE]
ON [dbo].[SALES]
    ([NavParentSaleWhenModSaleId]);
GO

-- Creating foreign key on [NavBusinessDayId] in table 'SHIFTS'
ALTER TABLE [dbo].[SHIFTS]
ADD CONSTRAINT [FK_BUSINESS_DAYSHIFT]
    FOREIGN KEY ([NavBusinessDayId])
    REFERENCES [dbo].[BUSINESS_DAYS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BUSINESS_DAYSHIFT'
CREATE INDEX [IX_FK_BUSINESS_DAYSHIFT]
ON [dbo].[SHIFTS]
    ([NavBusinessDayId]);
GO

-- Creating foreign key on [BUSINESS_DAY_Id] in table 'DEPOSITS'
ALTER TABLE [dbo].[DEPOSITS]
ADD CONSTRAINT [FK_ASSN_BUSINESS_DAY_DEPOSIT]
    FOREIGN KEY ([BUSINESS_DAY_Id])
    REFERENCES [dbo].[BUSINESS_DAYS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_BUSINESS_DAY_DEPOSIT'
CREATE INDEX [IX_FK_ASSN_BUSINESS_DAY_DEPOSIT]
ON [dbo].[DEPOSITS]
    ([BUSINESS_DAY_Id]);
GO

-- Creating foreign key on [NavHouseAccountId] in table 'TRANSACTIONS'
ALTER TABLE [dbo].[TRANSACTIONS]
ADD CONSTRAINT [FK_ASSN_HOUSE_ACCOUNT_TRANSACTION]
    FOREIGN KEY ([NavHouseAccountId])
    REFERENCES [dbo].[HOUSE_ACCOUNTS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_HOUSE_ACCOUNT_TRANSACTION'
CREATE INDEX [IX_FK_ASSN_HOUSE_ACCOUNT_TRANSACTION]
ON [dbo].[TRANSACTIONS]
    ([NavHouseAccountId]);
GO

-- Creating foreign key on [NavKioskId] in table 'PRODUCT_GROUP_PRINTER_EXCLUSIONS'
ALTER TABLE [dbo].[PRODUCT_GROUP_PRINTER_EXCLUSIONS]
ADD CONSTRAINT [FK_ASSN_KIOSK_PRODUCT_GROUP_PRINTER_EXCLUSION]
    FOREIGN KEY ([NavKioskId])
    REFERENCES [dbo].[KIOSKS]
        ([Id])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ASSN_KIOSK_PRODUCT_GROUP_PRINTER_EXCLUSION'
CREATE INDEX [IX_FK_ASSN_KIOSK_PRODUCT_GROUP_PRINTER_EXCLUSION]
ON [dbo].[PRODUCT_GROUP_PRINTER_EXCLUSIONS]
    ([NavKioskId]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------